07
Aug
07

Creating full-screen Flex applications

Here is a quick post on using Flash Player 9’s Full-Screen Mode in Flex. I’ve seen this appear a few times in the bugbase and on lists, but here is some simple code to let you toggle between “full screen mode” and “normal mode” in a Flex application. Note that in this example I’m listening for the applicationComplete event in the main <mx:Application /> tag instead of the creationComplete event. The applicationComplete tag is called slightly after the creationComplete event, after the Application has been completely initialized.

If you try and access the Application.application.stage property from the creationComplete event, you’ll get a run-time error (RTE) saying the following:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at main/init()
at main/___main_Application1_creationComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.core::UIComponent/set initialized()
at mx.managers::LayoutManager/doPhasedInstantiation()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()
at mx.core::UIComponent/callLaterDispatcher()

The example below is pretty bare with just a few Label controls and a Button control, but it should have enough of the required code to give you a push in the right direction.

Full code after the jump.

You must have version 9,0,28,0 or greater of Flash Player installed to use full-screen mode. Download the latest version of Adobe Flash Player.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/07/creating-full-screen-flex-applications/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init(event)">

    <mx:Script>
        <![CDATA[
            import flash.display.StageDisplayState;

            private function init(evt:Event):void {
                /* Set up full screen handler. */
                Application.application.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);
                dispState = Application.application.stage.displayState;
            }

            private function fullScreenHandler(evt:FullScreenEvent):void {
                dispState = Application.application.stage.displayState + " (fullScreen=" + evt.fullScreen.toString() + ")";
                if (evt.fullScreen) {
                    /* Do something specific here if we switched to full screen mode. */
                } else {
                    /* Do something specific here if we switched to normal mode. */
                }
            }

            private function toggleFullScreen():void {
                try {
                    switch (Application.application.stage.displayState) {
                        case StageDisplayState.FULL_SCREEN:
                            /* If already in full screen mode, switch to normal mode. */
                            Application.application.stage.displayState = StageDisplayState.NORMAL;
                            break;
                        default:
                            /* If not in full screen mode, switch to full screen mode. */
                            Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;
                            break;
                    }
                } catch (err:SecurityError) {
                    // ignore
                }
            }
        ]]>
    </mx:Script>

    <mx:String id="dispState" />

    <mx:Label text="width={Application.application.width}" />
    <mx:Label text="height={Application.application.height}" />
    <mx:Label text="displayState={dispState}" />

    <mx:Button label="Toggle fullscreen" click="toggleFullScreen()" />

</mx:Application>

View source is enabled in the following example.

For more information on Full Screen Mode in Flash Player 9 (ActionScript 2.0 and ActionScript 3.0) check out the following article on the Adobe Developer Center: “Exploring full-screen mode in Flash Player 9″.

I *knew* I would have forgotten something. The real trick to using FullScreen support is to enable it in the JavaScript embed code, or <object /> and <embed /> tags… So, in your HTML wrapper, add the following property:

AC_FL_RunContent(
    "src", "main",
    "width", "100%",
    "height", "100%",
    "align", "middle",
    "id", "main",
    "quality", "high",
    "bgcolor", "#869ca7",
    "name", "main",
    "allowScriptAccess","sameDomain",
    "type", "application/x-shockwave-flash",
    "pluginspage", "http://www.adobe.com/go/getflashplayer",
    "allowFullScreen", "true"
);

Or, if you are using <object /> and <embed /> tags, you can use the following syntax instead:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
        id="main" width="100%" height="100%"
        codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
        <param name="movie" value="main.swf" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#869ca7" />
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="true" />

    <embed src="main.swf" quality="high" bgcolor="#869ca7"
        width="100%" height="100%" name="main" align="middle"
        play="true"
        loop="false"
        quality="high"
        allowScriptAccess="sameDomain"
        allowFullScreen="true"
        type="application/x-shockwave-flash"
        pluginspage="http://www.adobe.com/go/getflashplayer">
    </embed>

</object>

Also, I just learnt from my co-worker Raghu’s blog (“FLEXing My Muscle” and his “Error on adding FullScreenListener in creationComplete handler” post) that you can use the SystemManager class instead of all my references to Application.application. Thanks Raghu!

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/07/creating-full-screen-flex-applications/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init()">

    <mx:Script>
        <![CDATA[
            import flash.display.StageDisplayState;
            import mx.managers.SystemManager;

            private function init():void {
                /* Set up full screen handler. */
                systemManager.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);
                dispState = systemManager.stage.displayState;
            }

            private function fullScreenHandler(evt:FullScreenEvent):void {
                dispState = systemManager.stage.displayState + " (fullScreen=" + evt.fullScreen.toString() + ")";
                if (evt.fullScreen) {
                    /* Do something specific here if we switched to full screen mode. */
                } else {
                    /* Do something specific here if we switched to normal mode. */
                }
            }

            private function toggleFullScreen():void {
                try {
                    switch (systemManager.stage.displayState) {
                        case StageDisplayState.FULL_SCREEN:
                            /* If already in full screen mode, switch to normal mode. */
                            systemManager.stage.displayState = StageDisplayState.NORMAL;
                            break;
                        default:
                            /* If not in full screen mode, switch to full screen mode. */
                            systemManager.stage.displayState = StageDisplayState.FULL_SCREEN;
                            break;
                    }
                } catch (err:SecurityError) {
                    // ignore
                }
            }
        ]]>
    </mx:Script>

    <mx:String id="dispState" />

    <mx:Label text="width={Application.application.width}" />
    <mx:Label text="height={Application.application.height}" />
    <mx:Label text="displayState={dispState}" />

    <mx:Button label="Toggle fullscreen" click="toggleFullScreen()" />

</mx:Application>

86 Responses to “Creating full-screen Flex applications”


  1. 1 li wenzhi Aug 8th, 2007 at 1:46 am

    good example, I didn’t know the difference between “applicationComplete” and “creationComplete” untill saw you tutorial.
    thank you!

  2. 2 Lively & Company Aug 8th, 2007 at 6:26 am

    Your blog is pretty awesome: this entry in particular. Application Complete, who knew? With that said, I keep getting a 1046 error relating to the evt:FullScreenEvent, around line 8. The exact diagnostic is…

    1046: Type was not found or was not a compile-time constant: FullScreenEvent.

    Any idea what the problem might be?

  3. 3 lucio Aug 8th, 2007 at 8:12 am

    Hi, i’ve tried the code but i get a “Error #2152: Full screen mode is not allowed” in Firefox 2.0.0.6 and IE 7. The funny thing it’s that it runs ok when using it from your site. So i guess it’s not a browser security/config related problem.
    Can you help me out ? thanks in advance !! great work and great site !!!!!!!!!!

  4. 4 peterd Aug 8th, 2007 at 8:48 am

    li wenzhi,

    There is a really good article over at Wietse Veenstra’s blog on “Understanding the Flex Application startup event order” which describes the order in which the various events (preinitialize, initialize, creationComplete, updateComplete and applicationComplete) get called. It’s a very good read and I highly recommend it.

    Lively & Co,

    If you are using the Adobe Labs version of Flex Builder 3, there was a bug (SDK-11792: “Class Missing: flash.events.FullScreenEvent”) where the FullScreenEvent class wasn’t working in the original beta 1 release. You can fix this by downloading and installing a newer nightly build of the Flex 3 SDK.

    Lucio,

    Sorry, I forgot to mention that you have to edit the HTML wrapper code to add the “allowFullScreen” property and set it to “true” (it is false by default). I updated the post above. Good catch, thanks.

  5. 5 lucio Aug 8th, 2007 at 9:47 am

    Thanks ! , now with thew missing html code work great !

  6. 6 irina Aug 11th, 2007 at 5:04 am

    This is a cool feature to add to my app, thanks for sharing the trick.
    The only problem is that with Flex 2 SDK it works only if I run the application in Debug mode and doesn’t when I run it in release… any ideas?
    Thank you!

  7. 7 andrei Aug 11th, 2007 at 9:44 am

    I’ve had almost the same problem.
    Thanks a lot.

  8. 8 peterd Aug 11th, 2007 at 9:48 am

    irina,

    Are you sure both your Debug and Release versions of the Flash Player are 9.0.28.0 or higher? I don’t think I mentioned it above, but I should update the post to mention that.

  9. 9 irina Aug 13th, 2007 at 1:09 pm

    I upgraded Flash player to 9.0.47.0 and still have the same problem… When I launch it from Flex 2 Builder in debug - works fine, but when I launch it in release - it doesn’t work… Thank you!

  10. 10 irina Aug 13th, 2007 at 5:05 pm

    hey, i got it working! i had wmode=opaque parameter set in the html (wasn’t there for debug mode) and that got in a way for some reason, it now works with that attribute removed.

  11. 11 peterd Aug 13th, 2007 at 5:14 pm

    irina,

    Thanks for the update.

    I checked the online docs and found this quote in the “Exploring full-screen mode in Flash Player 9″ article on the Adobe Developer Center:

    Full-screen mode was not originally supported if the wmode is opaque or transparent windowless, but it is now supported starting with the latest Flash Player 9 Update on Adobe Labs…

    I believe the current posted Adobe Flash Player build number on Labs is “9.0.60.120″, which lists among its features and enhancements:

    Enhancements to full-screen mode to use hardware scaling for improved video performance and quality on systems running Windows 2000 and newer or Mac OS X 10.2 and newer.

    Happy Flexing!

  12. 12 Shamick Aug 23rd, 2007 at 10:35 am

    See for dummies like me, if you want me to use that mxml or whatever that actually is, you have to say, put this one here in head, link there, etc. I am lost … I see your example but can’t figure out where and to what to stick this to?

    Fortunately the allow full scale = true works good enough …

    Just a though, must write to lowest denominator :-)
    Thanks do for good blog.

    Shamick

  13. 13 peterd Aug 23rd, 2007 at 9:28 pm

    Shamick,

    Yeah, sorry. It is a bit confusing since full-screen does require a few different moving parts (MXML HTML/JavaScript). But you do have a good point, I should update the ZIP file for these examples to include all the JavaScript HTML SWF files and not just the MXML source.

    Peter

  14. 14 selva Aug 31st, 2007 at 8:29 am

    I get the same error as Lively & Company …
    1046: Type was not found or was not a compile-time constant: FullScreenEvent.
    can you tell me what the problem could be and what i should do to activate fullscreen

  15. 15 Justin Buser Sep 8th, 2007 at 9:40 am

    Alternatively, if you have a clue what you are doing and want to skip all the BS above, here is a much shorter version. You never have to use Application.application from within the main app mxml file btw, nor do you have to use the system manager in this instance. This will create the exact same results as the example above but with only 4 lines of code:

  16. 16 Justin Buser Sep 8th, 2007 at 9:42 am

    My apologies, I didn’t realize this blog stripped tags from posts, hopefully this one shows up right:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="{stage.addEventListener('fullScreen',function(e:Event):void{ debugText.text='width:' width ' height: ' height '\rDisplay State: '   stage.displayState; })}">
    <mx:Text id="debugText" text="width: {width} height: {height '\r'}Display State: normal" width="200" height="60" textAlign="left" />
    <mx:Button label="Toggle fullscreen" click="{stage.displayState=='fullScreen' ? stage.displayState='normal' : stage.displayState='fullScreen';}" />
    </mx:Application>
    
  17. 17 peterd Sep 8th, 2007 at 10:53 am

    Justin,

    Awesome work, thanks for the tip!

    Peter

  18. 18 peterd Sep 8th, 2007 at 10:58 am

    selva,

    Which version (and build) of the Flex SDK are you using? I believe there was a problem with the Labs version of Flex Builder 3 Beta 1, but if you update to a newer nightly build everything should be A-OK.

    Peter

  19. 19 shilpi Sep 13th, 2007 at 10:59 am

    Peter,
    I tried to get source code from this page. Full screen does not work. I installed player gain. Found another example with no source code where full screen works. Can you please post the final source code?. I am kind of newbe. Thanks.

    sh

  20. 20 peterd Sep 13th, 2007 at 10:05 pm

    shilpi,

    Which version of the Flash Player are you using? (If you aren’t sure, you can check out this post and it should have an embedded SWF that will tell you the OS, Player Version, and whether or not its a debug version of Flash Player: “Debugging Flex applications with mm.cfg and flashlog.txt“.) And did you modify the HTML template and set the “allowFullScreen” property to “true” in both the JavaScript and Object/Embed tags?

    I’ve updated the ZIP file (FullScreen_test.zip) with the MXML as well as the HTML/SWF/JavaScript. Can you try downloading the ZIP file again and trying the sample?

    Peter

  21. 21 shilpi Sep 25th, 2007 at 9:51 am

    Peter,
    I am very sorry that I did look at your comment when I checked for your reply. Noticed my name on top and stopped right there. Many thanks for replying right back.
    I was able to build and run fine with this and after copying your code. My problem was that I did not have playerglobal.swc needed to run video. You may want to include that file in your source - I had trouble fnding that file!.

    – shilpi

  22. 22 nor Sep 28th, 2007 at 9:55 am

    i need a code rhat can enable my myspace to be views in full screem
    wgen visited, the code needs to be in style tags of some kind, css only works that i know of
    will pay for it

  23. 23 stef Oct 4th, 2007 at 9:09 am

    Thanks a lot ;)

  24. 24 Janko Oct 6th, 2007 at 2:42 am

    Hi, thanks for the great tutorial, but for a beginner like me does help much :(
    I was wondering if you could help me out.
    How can i add this full screen function to my website?
    I only know how to work in flash, i don’t know flex.
    So, how do i make a button in flash that calls this script?
    This means a lot,
    Cheers!

  25. 25 BloOdFiRe Oct 30th, 2007 at 3:35 am

    Hello,

    I try to switch my application in fullscreen mode at the launch. I don’t want to have to push a button to switch to fullscreen mode…

    BUT when a force Fullscreen in the applicationComplete Event i have the message : Fullscreen not allowed… And when i push the toggle fullscreen button it works….

    Somebody have a solution?

    Thank you very much for your contribution.

  26. 26 Adam Nov 4th, 2007 at 2:30 am

    I might be incredibly stupid, but whenever I tried to add this code to my project, it says I can’t override a built in function. So I did a little investigating, and it turns out there’s a “toggleFullScreen” already for a Click event? I’m really confused. Thanks!

  27. 27 peterd Nov 4th, 2007 at 8:08 am

    Adam,

    I don’t see a “toggleFullScreen” method/property in the Flex 3 Language Reference. If you want to try posting some code, I can take a look.

    Just remember that you may need to escape “<” characters as “&lt;” and “>” characters as “&gt;”, otherwise the blog may eat your code.

    Peter

  28. 28 Phillip Nov 30th, 2007 at 4:50 am

    I cant see my post so ill post again

    A funny fact.
    If you write mysite.com/main it wont work.
    If you write mysite.com/main.html it will work
    I have no idea why this is so,
    Im using IE7.

    Phill

  29. 29 airsea Dec 25th, 2007 at 1:33 am

    BloOdFiRe
    I met the same problem, I even try to force toggle fullscreen button dispatch mouse_click event in the applicationComplete Event. this error still there. I have no idea. Any body could help us? Thanks very much!

  30. 30 airsea Dec 25th, 2007 at 1:35 am

    Fullscreen not allowed…

  31. 31 ISOmorph Dec 25th, 2007 at 9:04 am

    Works like a charm, although i’d really like to supress the message telling the user that pushing escape will end the fullscreen. Any idea on how to accomplish that? thx.

  32. 32 Gustavo Scanferla Jan 27th, 2008 at 2:54 pm

    Very good! It works fine… Except one very important thing :(

    When I’m at the fullscreen mode, I can’t write anything in the flex application!
    I can’t even select a textbox or textarea, etc…

    Can you help me? If someone knows the answer, e-mail me: gugahawk@gmail.com

    Thanks!

  33. 33 Gustavo Scanferla Jan 27th, 2008 at 3:19 pm

    Oh no, sadly there is no error, it should act like that:

    “Users cannot enter text in text input fields while in full-screen mode. All keyboard input and key-related ActionScript is disabled while in full-screen mode, with the exception of the keyboard shortcuts that take the viewer out of full-screen mode.”

  34. 34 Alexander Jan 27th, 2008 at 7:30 pm

    Hello, your blog is the only one that works for me, everytime i get stuck you have a blog post about it. and i mean about 9 times so far.

    My question is, I want to change the “Press esc button to exit full screen mode” to a different language. Is this possible without defining a locale? Or is it possible to create my own locale?

    thanks so much for your contribution.
    Alex

  35. 35 peterd Jan 27th, 2008 at 10:57 pm

    Alexander,

    I don’t believe it is currently possible to localize that “Press Esc button…” message. Feel free to submit a bug report or enhancement request at http://www.adobe.com/go/wish?product=17

    Peter

  36. 36 Raj Mar 3rd, 2008 at 10:38 pm

    Cool,
    Though my app switches to full screen
    once navigated, my browser is getting crashed (Both FF and IE).
    Navigation includes (change in ViewStack’s children)

    Thanks

  37. 37 peterd Mar 3rd, 2008 at 11:00 pm

    Raj,

    What version of Flash Player do you currently have installed for each browser?
    http://blog.flexexamples.com/about-you/

    Peter

  38. 38 vincent lesieux Mar 16th, 2008 at 3:16 pm

    Many thanks Peterd for your tricks that help me more than books do.
    However, i tryed the creation of full screen and encountered a problem.
    I can no longer write any text in my application.
    Could you help me ?
    Thank you.

  39. 39 peterd Mar 17th, 2008 at 7:34 am

    vincent lesieux,

    Keyboard input is disabled when you are running in full screen mode.

    Peter

  40. 40 Dhinakaran Mar 19th, 2008 at 1:27 am

    Hi,

    I have a flex application and i have loaded a swfloader(player) in a small panel. Now i want to make this small panel into full screen and i want to restore.

    If i want to make a main application as a full screen mode, its working fine.But can anyone know the solution for the above pbm?

    thanks
    Dhinakaran.C

  41. 41 Ganesh Mar 25th, 2008 at 4:50 pm

    Thanks Peter for your wonderful efforts. Your code helped me too! I was playing around with it and realized that when I click on the full screen button on a cloned implementation on my app, the Full screen version always shows up on my primary monitor, irrespective of where the browser is. However the demo app you have on this blog loads shows the full screen on the correct monitor. Any ideas to where the problem might be? Thanks in advance!

  42. 42 Alex Grande Apr 6th, 2008 at 12:43 pm

    Hey great blog! Thanks for the tips. I wonder how to provide the application with a full screen property so as soon as you go to the swf, so the page goes full screen automatically. I’m building a website in html/css but need the full screen functionality of flash 9 on one of the pages with a timer. Or some how include the full screen toggle with the Start Dream Creation button. Here is the code for what I’m working on and want this to be full screen. This code is a edit of another example on this website. I would link to it but I don’t want to F with your SEO.

  43. 43 peterd Apr 6th, 2008 at 8:59 pm

    Alex Grande,

    I don’t believe you can force full-screen. I believe it needs to be initiated by a user event (mouse click, for example).

    Peter

  44. 44 abhishek Apr 7th, 2008 at 2:50 am

    its give an error to me

    Error #2152: Full screen mode is not allowed. ( which is SecurityError)

  45. 45 peterd Apr 7th, 2008 at 8:08 am

    abhishek,

    Did you edit the HTML container and set the allowFullScreen attribute to true?

    Peter

  46. 46 Chris Apr 14th, 2008 at 7:52 am

    I have full-screen mode working but my Flex application, when loaded in an IE browser, does not seem to allow any user interaction once the Flex app is in full-screen mode. It’s almost as if something is blocking user interaction.

    Anyone ever seen this?

    I am running Flash 9,115,0. It’s the oddest thing. It works fine when running through straight Flash player (minus the IE browser, etc.).

    Thanks.

  47. 47 vinitha Apr 18th, 2008 at 4:04 am

    Hi,

    I am working on flex application with .net. I want to open a modal dialog box (asp.net page) on click of a button placed in the flex application. How can i achieve this?

    Thanks in advance…

  48. 48 Abdul May 7th, 2008 at 12:33 am

    hello sir i am facing problem to create slide show in flex plz could you tell me the procedure plz sir i want script how to create slide show on flex

  49. 49 Anthony Picciano May 14th, 2008 at 7:08 am

    Thanks for sharing this, Peter.

    One thing that is somewhat annoying is that if the Flex application contains a video anywhere in the application (in my case a FLVPlayback component) going into full screen mode only shows the video component, not the entire application. Commenting out the video component allows the whole application to be full screen.

    Does anyone know how to allow a Flex application with video to show the whole application when in full screen mode?

  50. 50 Anthony Picciano May 14th, 2008 at 7:17 am

    After a little more Googling, I found the answer to my own question. I thought others might be interested, so I’m reposting it here:

    Why does FLVPbaybak component take over the whole screen when the Flex application goes into full screen mode?

    For the FLVPlayback Flash component this is the default. If you want to see the other elements then set it to false.

    fullScreenTakeOver : Boolean
    “When the stage enters full-screen mode, the FLVPlayback component is on top of all content and takes over the entire screen.”

  51. 51 subbu Jun 9th, 2008 at 1:49 am

    Is it possible fullscreen mode in flex apllication?If it is yes plz suggest how to write the full screen mode application…

  52. 52 Dylan Oliver Jul 2nd, 2008 at 4:00 pm

    The code above got me started but this uses a getter/setter on fullScreen:Boolean to allow you to enter fullscreen mode with “fullScreen=true” and bind to the value of fullScreen, as I do below with the checkbox:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
      <mx:initialize><![CDATA[
      systemManager.stage.addEventListener(
        FullScreenEvent.FULL_SCREEN,
        function(event: FullScreenEvent): void {  fullScreen = event.fullScreen; }
      );
      ]]></mx:initialize>
    
      <mx:Script><![CDATA[
      private var _fullScreen: Boolean;
      [Bindable] public function get fullScreen(): Boolean { return _fullScreen; }
      public function set fullScreen(isFull:Boolean):void {
      _fullScreen = isFull;
      stage.displayState = (isFull) ? StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL;			}
      ]]></mx:Script>
    
      <mx:CheckBox id="fs" label="Full Screen"
        click="fullScreen=event.target.selected" selected="{fullScreen}"
        horizontalCenter="0" verticalCenter="0"/>
    
    </mx:Application>
    
  53. 53 Boaz Jul 5th, 2008 at 1:20 pm

    Peterd,
    i saw you answered that the Keyboard events are disable in full screen mode,
    can you tell why? is it going to be solved soon? test is the name of the game
    in RIA…
    Boaz

  54. 54 Philippe Schlier Aug 21st, 2008 at 10:02 am

    Hello,
    I’m new on Flex but from what I read, the Full screen mode doesn’t allow text input nor switching tab. This is a show stopper for me. Is there a way of going around those restrictions ? Instead of Flex’s full screen mode, I could use a browser full screen but how to trigger a F11 keystroke on the browser from a Flex link ?

    Happy Flex
    Philippe

  55. 55 MechanisM Aug 27th, 2008 at 4:26 pm

    how to add fullscreen here:

    <script type="text/javascript">
            // <![CDATA[
                var so = new SWFObject('MechanisM.swf', 'website', '100%', '100%', '10', '#000000');
                so.useExpressInstall('swfobject/expressinstall.swf');
                so.write('content');
            // ]]>
            </script>
    
  56. 56 peterd Aug 27th, 2008 at 5:25 pm

    MechanisM,

    I’ve never tried SWFObject, but does something like this work?

    <script type="text/javascript">
    // <![CDATA[
       var so = new SWFObject('MechanisM.swf', 'website', '100%', '100%', '10', '#000000');
       so.addVariable("allowFullScreen", "true");
       so.useExpressInstall('swfobject/expressinstall.swf');
       so.write('content');
    // ]]>
    </script>
    

    Peter

  57. 57 MechanisM Aug 29th, 2008 at 7:47 pm

    Thnxx Peterd!!!

  58. 58 Steve W Sep 4th, 2008 at 3:24 pm

    Peter,

    Is there any work being done to enable full functionality (e.g. text input) in the full screen mode? Without this capability, it’s not good for much more than a video player or statis charting application. Supposedly there is some security concern, but it needs to be up to the developer/client to decide (fullScreenInteractive = “true”).

  59. 59 penpen Sep 4th, 2008 at 7:23 pm

    很好,很强大

  60. 60 Andrea Sep 6th, 2008 at 1:03 pm

    Great post Peter,
    but I’m guessing at text input problem.
    I totally got lost trying to find a work around..

    any advice?

    thank you,
    andrea

  61. 61 peterd Sep 6th, 2008 at 7:18 pm

    Andrea,

    Text input is currently not supported while a Flash/Flex application is in full screen mode in Flash Player.

    Peter

  62. 62 Yaba Sep 9th, 2008 at 8:14 am

    “Text input is currently not supported while a Flash/Flex application is in full screen mode in Flash Player.”

    And hopefully will never be. Consider a page that renders a full screen flex window showing a standard Windows log in screen. How many will think that something weird has happened to Windows once again and enter the login credentials into the malicious window?

  63. 63 Magz Sep 17th, 2008 at 2:21 pm

    Hey!

    Is it possible for an AIR application to have two stages which go fullscreen on two monitors with different content? I would like a movie on full screen on my secondary display and controls on the other, both in fullscreen. This would really help me out, thanks!

  64. 64 peterd Sep 18th, 2008 at 7:55 am

    Magz,

    I’m not aware of any APIs that allow you to do that (but I’m certainly no AIR expert). Maybe try asking on a high-traffic list like FlexCoders and see if anybody has tried experimenting with AIR + full screen + dual monitors.

    Sorry,
    Peter

  65. 65 smacks Oct 15th, 2008 at 9:13 am

    Very good work great thx for this great tutorial !!!

  66. 66 Falco Stellare Oct 24th, 2008 at 5:27 am

    In AIR you can use the FULL_SCREEN_INTERACTIVE statement to go fullscreen with working text inputs. It could be nice to have this feature in Flex too. I undestand all the security issues bond with this function, but I can’t believe that there is not a workaround in order to let us developers design a fully functional fullscreen application and at the same time let users keep their security safe.

    At the current conditions, fullscreen feature in Flex is nothing more than an oddity, good just for poorly interactive web sites…

    If this problem can’t be solved, I think I’ll abandone the Flex platform very quickly :-(((

  67. 67 Falco Stellare Oct 27th, 2008 at 3:08 am

    Adobe developers say that disabling text inputs when in fullscreen is a security feature: you cannot interact with a Flex application running fullscreen because a potential hostile could duplicate a login interface and stole your account, with a well-known phishing technique.

    But did you noticed a funny thing? You can’t write directly into an input field in fullscreen mode, yes, but you can always <b>PASTE TEXT INTO IT</b> (right-click on the field, and then select “paste” from the popup menu) and thus completely bypass the clever and strong security “fullscreen feature”. No need for hacks, patches, or whatever. <b>Just copy a text from notepad and paste it into the “disabled” input field of your fullscreen Flex application</b>: oh my god, the disabled input field works again! Press your submit button, and go.

    WOW!!! :-\

    Dear Adobe developers, please, remove this silly limitation NOW, and try to deal with security issues in better ways. <b>Security through obscurity is nothing but a failure</b>, if you are a real software developer.

    There are peoples here, who try to produce useful interactive applications with Flex (in my case, applications to be used for scientific research in oncology and molecular biology) and who really would like to take advantage from a fully working fullscreen feature…

    And please, don’t suggest to switch to AIR, this is not a valid alternative if you’re developing an application to be distributed as a web service.

  68. 68 Simon Nov 3rd, 2008 at 4:01 pm

    Hi,

    I have a white screen when I insert “allowFullScreen”, “true”. The problem occur exactly if I insert this line. Any idea why, apparently, javascript don’t like this…

    I use as well Cairngorm, locales, and external module but I don’t think it’s related ?

    By the way I can run your example and I have the last player version.

    Thanks
    Simon

  69. 69 dbx166xl Nov 10th, 2008 at 8:33 am

    Via Flex 3, & Flash Player 10, editing the html template file produces a blank screen in Firefox 3. Anyone else having this issue? Thanks in advance!

  70. 70 Tiago Dec 22nd, 2008 at 2:19 pm

    Pessoal eu não concegui realizar o teste ….
    alguem poderia me ajudar ?

    Eu clico no botão mas não acontece nada, eu ja abilitei o “allowFullScreen”, “true”
    Teria como algeum me passar um video ou um projeto completo de exemplo?

    Obrigado!

  71. 71 Tiago Dec 22nd, 2008 at 2:23 pm

    I click on the button but nothing happens, I already enable the “allowFullScreen”, “true”
    Algeum can I pass a video or complete a project as an example?

    Thank you!

  72. 72 Bevsta Dec 27th, 2008 at 8:22 am

    Magz.. regarding your query.. I think WebOrb can potentially do this in a couple of ways.. one of which is to use shared objects to pass information between the 2 different browser instances or potentially stages, each of which could be hosting different content but effectively be communicating to be ‘one application..

  73. 73 tyler Jan 8th, 2009 at 8:41 am

    What if you have another swf inside of your flex app using fullscreen? It is a video player and I want to make the video player go fullscreen on click, but the whole flex app goes fullscreen. How do I capture that and tell flex to make that inside player be the thing that is FS?

  74. 74 Ewout Feb 18th, 2009 at 3:13 am

    Thanks for this great article. While trying to enable “automatic full screen” I encountered several security errors and found some solutions:

    - From inside a browsers window you just can’t automatically switch to fullscreen; even when you dispatch a clickevent. It can only be triggered by a REAL clickevent.

    - When compiled and exported to a projector (from within flashplayer) you actually CAN automate fullscreen and have textinputs etc. enabled (this last thing I did not test).

    :)

  75. 75 Michael Mar 2nd, 2009 at 11:58 pm

    Debugging Fullscreen applications in Flex Builder:

    http://devote.your.life.auricom.com/?p=65

  76. 76 daniel Mar 3rd, 2009 at 7:01 pm

    thank you for this great function;
    i haven’t had time to read your post through; but i’m sure it’s very useful.
    the code works; and was easy to add to a project.

    thanks again and
    please keep it up :P

  77. 77 daniel Mar 3rd, 2009 at 10:32 pm

    @tyler: i think you can just stretch the video swf to the full screen size by making the flex app full screen and then directly after that; changing the video swf’s height and width properties to the same as full size of the screen / stage.

    hth

  78. 78 lee probert Mar 5th, 2009 at 8:57 am

    @tyler I had this problem so what I did was create two Video containers, one of them sitting above everything else within a Box container with a black background and its visibility bound to a Boolean that represented the Fullscreen mode. When the video is playing you swap the NetStream from one Video container to the other. The result is a seamless bit of fullscreen video without the rest of the SWF content.

  79. 79 elDalai Mar 19th, 2009 at 7:34 am

    Hi!

    i need to use in my FullScreen Application the ESCAPE key for navigation…

    My cuestion is:

    Could i disable o cancel the FullScreenEvent and use the KeyboardEvent.KEY_DOWN ? i need an only fullScreen App….

    this.addEventListener(KeyboardEvent.KEY_DOWN, keyDownEventHandler);

    }
    private function keyDownEventHandler(event:KeyboardEvent):void {
    switch(event.keyCode)
    {
    case Keyboard.ESCAPE: cancelAction();break;//never happends
    case Keyboard.ENTER: goAction();break;
    }
    }

    Thanks!

  80. 80 sam Mar 20th, 2009 at 2:44 pm

    keyboard disabled in full screen mode…

    sam

  81. 81 Jon Mar 26th, 2009 at 2:03 pm

    Excellent site.

    I went through the entire tutorial just to find out that my Flex application at Full Screen will not allow inputs. This is still the case after 1.5 years time, eh? Ouch.

    I guess I’ll read all the comments before actually trying the code next time. A blurb at the beginning of the article could’ve saved me 30 mins though…

  82. 82 Jon Mar 26th, 2009 at 2:11 pm

    For more on why the Adobe crew decided to not allow user-input while in Full Screen mode:

    http://livedocs.adobe.com/flex/3/html/help.html?content=05B_Security_06.html

    Seems silly, but it’s the fastest solution to their security issue with full-screen.

    Beginning code workaround… now.

  83. 83 Sundance May 14th, 2009 at 12:46 pm

    Hi! Theres any way to modify the wrapper file generated from Adobe Flex Builder? I hate to modify all the time the Full screen options. Thanks in advance

  84. 84 Sundance May 14th, 2009 at 4:17 pm

    I mean, theres a posibility to change automatically the content of the wrapper file on Flex IDE to make this fullscreen options available without modify the wrapper file by hand, beacose when you change the source the wrapper change too. Thanks and sorry for double post
    Sun

  85. 85 Pankaj Jun 2nd, 2009 at 10:35 am

    There is no place in the IDE in order to change or add params but you can go to the root folder of your project, and go into html-template and add these parameters in index.template.html and save the file.
    This is a template html file, flex builder uses, in order to generate html wrapper file.

    -Pankaj

  86. 86 Tahir Alvi Jun 3rd, 2009 at 11:58 pm

    I am very thank full and for using this example, but i want to know that Videodisplay control is capable of full screen, or canvas or any other container except application.

    It would be nice if any body send me the answer.

Leave a Reply

This blog is terrible at eating HTML tags. If you plan on posting code/XML, please escape your "<" characters as "&lt;" and your ">" characters as "&gt;".




Badge Farm

  • Powered by Redoable 1.2
  • Cornify
  • Feeds burnt by Feedburner
  • Feed