Copy link to clipboard
Copied
My Problem:
I have a Flash presentation that launches from a USB stick. It opens in full screen mode, which has a button for the user to toggle between fullscreen mode and back. This works great and I'm happy with it.
However I want to be able to load an FLV player to play a how to video inside the fullscreen player which the user can toggle to full screen and back without taking over the whole stage, and my full screen toggle button.
I know I can set the fullscreen take over to false ie myVideo.fullScreenTakeOver = false; however I still want the video to have the ability to go full screen.
I have developed a bit of a hack, but it's messy and doesn't work with the finesse I was hoping this project would have.
What I want to do: Have the the screen remain in fullscreen as the flv player exits fullscreen.
This is my 'hack':
ActionScript Code:
stage.addEventListener(Event.FULLSCREEN,f);
function f(e:Event){
if (myVideo.playing == true)
{
myVideo.fullScreenTakeOver=true;
} else {
myVideo.fullScreenTakeOver=false;
}
}
I am using the FLV component in flash. I know I can create my own and make my own fullscreen button but I am not sure how this is going to help me. I've already wasted far too much time trying to figure this out so any advice or even a finger point in the right direction would be much appreciated!
I've made many google searches and read what feels like hundreds of articles and threads but not found an answer to my problem. I have an intermediate knowledge of Action Script 3. Currently this is what my script looks like.
Current Action Script:
// AllowScale
import flash.display.StageScaleMode
stage.scaleMode = StageScaleMode.SHOW_ALL;
import flash.system.fscommand;// Open in fullscreen
fscommand("fullscreen","true");
fscommand("allowscale", "true");
fscommand("maximize", "true");
import flash.display.StageDisplayState;
stage.displayState = StageDisplayState.FULL_SCREEN;
// Screen Toggle
ScreenToggle.setLabel("Full Screen on/off");ScreenToggle.addEventListener(MouseEvent.CLICK, toggleFullScreen2);
function toggleFullScreen2(event:MouseEvent):void
{
if (this.stage.displayState == StageDisplayState.FULL_SCREEN)
this.stage.displayState=StageDisplayState.NORMAL;
else
this.stage.displayState=StageDisplayState.FULL_SCREEN;
this.stage.displayState=StageScaleMode.EXACT_FIT;
}function onFullScreen(fullScreenEvent:FullScreenEvent):void
{
var bFullScreen=fullScreenEvent.fullScreen;
if (bFullScreen)
{
// do something here when the display changes to full screen
}
else
{
// do something here when the display changes to normal
}
this.textField.text=this.stage.displayState;
}stage.addEventListener(Event.FULLSCREEN,fullscreenFix);
function fullscreenFix(e:Event){
if (myVideo.playing == true) {
myVideo.fullScreenTakeOver=true;
} else {
myVideo.fullScreenTakeOver=false;
}
}// Importing the video package
import fl.video.*;var myVideo:FLVPlayback = new FLVPlayback();
myVideo.source = "videos/video2.flv";
myVideo.skin = "SkinOverAllNoCaption.swf";
myVideo.x = 0;
myVideo.y = 0;
myVideo.width = stage.stageWidth;
myVideo.height = stage.stageHeight;
myVideo.skinBackgroundAlpha = 0.5;
myVideo.skinAutoHide=true;
myVideo.skinFadeTime=300;
myVideo.skinBackgroundColor = 0x333333;
myVideo.autoPlay = false;
addChild(myVideo);//Funtions on video when it completes
function completeHandler(event:VideoEvent):void
{
removeChild(myVideo);
nextFrame();
}
myVideo.addEventListener(VideoEvent.COMPLETE, completeHandler);
Thanks in advance.
Copy link to clipboard
Copied
I know I can set the fullscreen take over to false ie myVideo.fullScreenTakeOver = false; however I still want the video to have the ability to go full screen.
You may have a false inuition how the fullScreenTakeOver property works. The fullscreenTakeOver-false property will make your video almost exactly behave as the normal one, with the only difference that you are able to put sth (movieclips, buttons) in front of the video even if it plays in fullscreen.
so if you are trying to place something in front of video that plays in the foreground with setChildIndex(stage.numChildren-1) it will only do sth if
fullscreenTakeOver is set to false. (the video will still play without borders, maximized to your users monitor.
Copy link to clipboard
Copied
Thank you so much for replying.
The problem I am getting is, when the video is loaded it takes over the screen. I'm using a FLV component so the controls are still visible, which is ok although I'd prefer it start in its small state. But when you toggle the video back to normal it also toggles the main stage out of fullscreen. I'd prefer for the screen to stay fullscreen as it gets a bit messy for the user.
Copy link to clipboard
Copied
Stage can only have fullscreen Off/On. Since a projector/swf loads all the files it needs on one stage, the different swf files can`t have their own fullscreen-mode.
There are different workarounds for your Problem:
1.Use a html-container and place your video in a different div than your main swf .
2.Use AIR and its nativeWindows capability (which enables AIR to have multiple "stages" that can be toggled individually
3."Fake" the fullscreenProperty of your Video by placing the video in a container and scaling/positioning it as if it were Fullscreen (you can get a users Montor resolution with system.capabilities )
Copy link to clipboard
Copied
Ahh ok, that would be why I can't do it!
I'll look in to your suggestions. Thanks so much for taking the time to help me.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now