Flash AS3 using FLVPlayback and Full Screen Mode

How to use the flash Full Screen Mode and video FLVPlayback Component for scaling your stage and movieclips.

Today I have come to learn that you can create your own full screen button like the built-in button function from the FLV player skin in Flash CS3.

Here is the code:

// things you may import in the future to customize this code
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.display.StageDisplayState;

myButton.addEventListener(MouseEvent.MOUSE_UP,function(evt:MouseEvent):void
{
stage.displayState = StageDisplayState.FULL_SCREEN
//or set it to normal like: stage.displayState = StageDisplayState.NORMAL;
}
);

Problem: Video is taking over the screen. Where did my text, graphics and buttons go?

When displaying video in your flash file by using FLVPlayback and you enter Full Screen Mode, the video will take over the screen. To prevent this from happening, you will have to add the code below:

NOTE: When the stage enters full-screen mode, the FLVPlayback component is on top of all content and takes over the entire screen. When the stage exits full-screen mode, the screen returns to how it was before.

// say your FLVPlayback component is named “myPlayer”:
myPlayer.fullScreenTakeOver = false;

This can also be used to fix the playback in flash Projector files as well.

Edit your html file in three places to allow full screen mode

One more thing to note is that you will have to edit your html page to allow for Full Screen Mode viewing. Publish your flash with the html option and open your html page. and look for “allowFullScreen” in three places:

1) Javascript AC_FL_RunContent code

2) Flash Object tag

3) Flash Embed tag

and set them all to “true”.

You may also like...

31 Responses

  1. Thank you it was exactly what i was looking, it works perfect. Simple fix.

  2. sdsd says:

    Fantastic. Your a great chap for sharing

  3. Garrett says:

    This is close to what I am experiencing, except that the whole screen goes black as soon as it loads an external SWF. I tried this code and it still doesn't work properly. I am developing a kiosk that has to be full screen, and nothing seems to be working right, Can you help?

  4. BB says:

    Absolutely what I was looking for. Cheers! 🙂

  5. balashankar says:

    Hi,

    I’m unable to see my player control in fullscreen mode, I’m have customized the player controls, fullscreen mode is happening but unable to see my control above it.

    Any help would be great.

  6. Roberto says:

    Garret, this happens with my application too!
    If you solve it, please notify me.
    Thanks,
    Roberto

  7. Johnny says:

    You’re a life saver!!!!!!!

  8. gramham says:

    You can’t just put the code anywhere, I made it work by putting it where the player is created:
    my_player = new FLVPlayback();
    my_player.fullScreenTakeOver = false;

    It wouldn’t work if I just placed it before:
    stage.displayState = StageDisplayState.FULL_SCREEN

    Anyway, it works for me!

    • Miguel says:

      @graham
      Thank youuuuuuuuuuu.
      Three days I spent triying to solve this issue…I was considerating to develop my own flvplayback component , arrrgggsss..

  9. Ron Leeson says:

    Thanks so much for sharing this fix. Exactly what I was looking for.

  10. usama says:

    i just place a vedio in uicomponent now the fullscreen function not working what can i do

  11. justanotherdesigner says:

    Seems to work for me but then scaling down on video exits fullscreen of stage. Hmmmm. 🙂 At least one part seems to be working. Thanks!

  12. daneacp says:

    Last night a DJ saved my life… and today was you! ^_^
    Thank you for your useful help!!!

  13. Flasher says:

    Thank you to the original poster and gramham. I’m working with an EXE file and the fullScreenTakeOver property is what I needed. Here’s the livedocs info on the property: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/video/FLVPlayback.html#fullScreenTakeOver

  14. VC:One says:

    Thanks a lot for this tip!!! this line just saved my ass…

    myPlayer.fullScreenTakeOver = false;

  15. Christophe says:

    Thanks a lot, I was searching that for a while…

  16. Justin says:

    Perfect! Thanks

  17. mrwizzer says:

    God bless ya, lad! Just what the doctor ordered! Saved me a ton of grief.

  18. Ade says:

    OMFG You have no idea how long I’ve been searching Adobe docs trying to find the reason why my FLVPlayer was behaving strangely when my projector was going fullscreen. Thank you being my random saviour!

  19. Niklas says:

    You saved my computer from taking a bath in the river! Thanks a lot! This is exactly what i was looking for! Too bad that Adobe does such an excellent job hiding those little details in the docs 😉
    Thanks again!

  20. SirDidymus says:

    Thanks so much for posting this. This saved me tons of work.

  21. MissHD says:

    Thank you very much ! You save me !

  22. PIIANTOM says:

    Super!!! Thanks a ton, you saved my day!!

  23. Azhar Kamar says:

    awesome! thanks for the tip. wonder why the fullscreen function isn’t built into component inspector.

  24. Saddam Hussien says:

    for Actionscript 3 the best solution is this:

    in the first frame of your flash file add this code:

    import flash.system.fscommand;
    fscommand(“fullscreen”, “true”);
    fscommand(“allowscale”, “false”);

    stage.addEventListener(Event.ADDED, FLVAdded, true);

    function FLVAdded(e:Event):void
    {
    if (e.target is FLVPlayback)
    {
    e.target.fullScreenTakeOver = false;
    }
    }

    FLVPlayback component is bugy, and to make (xyz.fullScreenTakeOver = false) work, then it must be excuted before the FLVPlayback instance is TRULY added to the stage. So, you can not do that by just adding the code (xyz.fullScreenTakeOver = false) to the same frame where the xyz instance of the FLVPlayback is added to the stage. The above code will solve this problem. Make sure that the video played by the FLVPlayback component is in the same folder of the resulting compiled SWF or EXE file. If you are using FLVPlayback with skin, then make sure the generated skin SWF file is in the same folder of your main SWF file. Hope this will help some people.

  25. Edwin says:

    A life saver. Thanks

  26. iDreadful says:

    Thanks a lot! It worked for me!

  27. soulrp says:

    Please, i’m new in flash and i don’t know were i put this fix fullscreen video line in my script.

    Someone can help me, plz?

    My code:

    stop();

    // things you may import in the future to customize this code
    import flash.display.Stage;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.display.StageDisplayState;

    myButton.addEventListener(MouseEvent.MOUSE_UP,function(evt:MouseEvent):void
    {
    stage.displayState = StageDisplayState.FULL_SCREEN
    //or set it to normal like: stage.displayState = StageDisplayState.NORMAL;
    }
    );

    stage.addEventListener(KeyboardEvent.KEY_UP, NextKey);
    function NextKey(event:KeyboardEvent):void
    {
    if (event.keyCode == 39)
    {
    nextFrame();
    }
    if (event.keyCode == 37)
    {
    prevFrame();
    }
    }

    Just i put the code “myPlayer.fullScreenTakeOver = false;” changing the instance of the video?

  28. José Gómez says:

    you are a lifesaver. great tip here.
    sidenote: if you have your flvplayer inside of a movieclip that includes other actionable movieclips, those other movieclips become bogus when you set the flvplayer to not take over fullscreenvideo. makes no sense.
    we had to pull the other buttons out and put them outside of our flvplayer container movieclip.

  29. Chika says:

    Hey guys, can you help me..
    I have 2 scenes in fullscreen, scene 1 cointains button to go to scene 2. In scene 2, there is my flvplayback video. When I click on button in scene 1, it goes blank. Can you solve this, please 🙁

  1. February 10, 2010

    […] Flash AS3 using FLVPlayback and Full Screen Mode | NewSourceMedia Blog […]

Leave a Reply to Chika Cancel reply