Fullscree in Flex

Hi

I need to expand my flashmovie to fullscreen, so I foud this tutorial: http://blog.flexexamples.com/2007/08/07/creating-full-screen-flex-applications/

But I can’t gett it to work.

I’ve tryed to write it i my own Flexfile, and I’ve tryed copy/paste, that’s the last section.

This is my code:


 [FONT=&quot]<?xml version="1.0" encoding="utf-8"?>[/FONT]
  [FONT=&quot]<mx:Application applicationComplete="init(event);" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="300" height="200">[/FONT]
  [FONT=&quot]           <mx:Script>[/FONT]
  [FONT=&quot]                      <![CDATA[[/FONT]
  [FONT=&quot]                      *   /*        import flash.display.Sprite*[/FONT]
  *[FONT=&quot]                                 import flash.events.MouseEvent[/FONT]*
  *[FONT=&quot]                                 import flash.display.StageDisplayState[/FONT]*
  *[FONT=&quot]                                 import mx.managers.SystemManager[/FONT]*
  
  *[FONT=&quot]private var background:Sprite; [/FONT]*
  *[FONT=&quot]                                 private var button:Sprite;[/FONT]*
  *[FONT=&quot]private var dispState;[/FONT]*
  
  *[FONT=&quot]                                 private function init():void[/FONT]*
  *[FONT=&quot]                                 {[/FONT]*
  *[FONT=&quot]                                            background = new Sprite();[/FONT]*
  *[FONT=&quot]                                            background.graphics.beginFill(0x116699);[/FONT]*
  *[FONT=&quot]                                            background.graphics.drawRect(0, 0, 300, 200);[/FONT]*
  *[FONT=&quot]                                            background.graphics.endFill();[/FONT]*
  *[FONT=&quot]                                            parent.addChild(background);[/FONT]*
  
  *[FONT=&quot]                                            button = new Sprite();[/FONT]*
  *[FONT=&quot]                                            button.graphics.beginFill(0x996611);[/FONT]*
  *[FONT=&quot]                                            button.graphics.drawRect(0, 0, 100, 50);[/FONT]*
  *[FONT=&quot]                                            button.graphics.endFill();[/FONT]*
  *[FONT=&quot]                                            button.addEventListener(MouseEvent.CLICK, toggleFullScreen);[/FONT]*
  *[FONT=&quot]                                            parent.addChild(button);[/FONT]*
  
  *[FONT=&quot]                                            systemManager.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullHandler);[/FONT]*
  *[FONT=&quot]                                            dispState = systemManager.stage.displayState;[/FONT]*
  *[FONT=&quot]                                 }[/FONT]*
  
  *[FONT=&quot]                                 /*private function clickHandler(event:MouseEvent):void[/FONT]*
  *[FONT=&quot]                                 {[/FONT]*
  *[FONT=&quot]                                            trace("Clicking");[/FONT]*
  
  *[FONT=&quot]                                 }[/FONT]*
  
  *[FONT=&quot]                                 private function fullHandler(event:FullScreenEvent):void[/FONT]*
  *[FONT=&quot]                                 {[/FONT]*
  *[FONT=&quot]                                            trace("UBBE!");[/FONT]*
  *[FONT=&quot]                                            dispState = systemManager.stage.displayState + "(fullScreen=" + event.fullScreen.toString() + ")";[/FONT]*
  
  *[FONT=&quot]if(event.fullScreen)[/FONT]*
  *[FONT=&quot]                                            {[/FONT]*
  *[FONT=&quot]                                                                                                  }[/FONT]*
  *[FONT=&quot]                                            else[/FONT]*
  *[FONT=&quot]                                            {[/FONT]*
  *[FONT=&quot]}[/FONT]*
  
  *[FONT=&quot]                                 //         toggleFullScreen();[/FONT]*
  *[FONT=&quot]                                 }[/FONT]*
  
  *[FONT=&quot]                                 private function toggleFullScreen(event:MouseEvent):void[/FONT]*
  *[FONT=&quot]                                 {[/FONT]*
  
  *[FONT=&quot]                                            try[/FONT]*
  *[FONT=&quot]                                            {[/FONT]*
  
  *[FONT=&quot]                                                       switch(systemManager.stage.displayState)[/FONT]*
  *[FONT=&quot]                                                      {[/FONT]*
  
  *[FONT=&quot]                                                                 case StageDisplayState.FULL_SCREEN:[/FONT]*
  *[FONT=&quot]                                                                            systemManager.stage.displayState = StageDisplayState.NORMAL;[/FONT]*
  *[FONT=&quot]                                                                 break;[/FONT]*
  *[FONT=&quot]                                                                 default:[/FONT]*
  *[FONT=&quot]                                                                            trace("MAKE FULL"); //Is traced[/FONT]*
  *[FONT=&quot]                                                                            systemManager.stage.displayState = StageDisplayState.FULL_SCREEN;[/FONT]*
  *[FONT=&quot]                                                                 break;[/FONT]*
  
  *[FONT=&quot]                                                      }[/FONT]*
  *[FONT=&quot]                                            }[/FONT]*
  *[FONT=&quot]                                            catch(error:SecurityError){}[/FONT]*
  *[FONT=&quot]                                 }*/[/FONT]*
  
  
  [FONT=&quot]                                **import** flash.display.StageDisplayState;[/FONT]
  
  [FONT=&quot]                                 **var** dispState;[/FONT]
  
  [FONT=&quot]            **private** **function** init(evt:Event):**void** {[/FONT]
  [FONT=&quot]                */* Set up full screen handler. */*[/FONT]
  [FONT=&quot]                **trace**(**"INIT"**);[/FONT]
  [FONT=&quot]                Application.application.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);[/FONT]
  [FONT=&quot]                dispState = Application.application.stage.displayState;[/FONT]
  [FONT=&quot]            }[/FONT]
  
  [FONT=&quot]            **private** **function** fullScreenHandler(evt:FullScreenEvent):**void** {[/FONT]
  [FONT=&quot]                dispState = Application.application.stage.displayState + **" (fullScreen="** + evt.fullScreen.toString() + **")"**;[/FONT]
  [FONT=&quot]                **trace**(**"HANDLER "** + evt.fullScreen); *//This is not traced*[/FONT]
  [FONT=&quot]                **if** (evt.fullScreen) {[/FONT]
  [FONT=&quot]                    */* Do something specific here if we switched to full screen mode. */*[/FONT]
  [FONT=&quot]                } **else** {[/FONT]
  [FONT=&quot]                    */* Do something specific here if we switched to normal mode. */*[/FONT]
  [FONT=&quot]                }[/FONT]
  [FONT=&quot]            }[/FONT]
  
  [FONT=&quot]            **private** **function** toggleFullScreen():**void** {[/FONT]
  [FONT=&quot]                **try** {[/FONT]
  [FONT=&quot]                    **switch** (Application.application.stage.displayState) {[/FONT]
  [FONT=&quot]                        **case** StageDisplayState.FULL_SCREEN:[/FONT]
  [FONT=&quot]                            */* If already in full screen mode, switch to normal mode. */*[/FONT]
  [FONT=&quot]                            Application.application.stage.displayState = StageDisplayState.NORMAL;[/FONT]
  [FONT=&quot]                            **break**;[/FONT]
  [FONT=&quot]                        **default**:[/FONT]
  [FONT=&quot]                            */* If not in full screen mode, switch to full screen mode. */*[/FONT]
  [FONT=&quot]                            **trace**(**"**[/FONT]**[FONT=&quot]NORMAL[/FONT]****[FONT=&quot]"[/FONT]**[FONT=&quot]); *//This is traced, but nothing happens.*[/FONT]
  [FONT=&quot]                            Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;[/FONT]
  [FONT=&quot]                            **break**;[/FONT]
  [FONT=&quot]                    }[/FONT]
  [FONT=&quot]                } **catch** (err:SecurityError) {[/FONT]
  [FONT=&quot]                    *// ignore*[/FONT]
  [FONT=&quot]                }[/FONT]
  [FONT=&quot]            }[/FONT]
  [FONT=&quot]                      ]]>[/FONT]
  [FONT=&quot]           </mx:Script>[/FONT]
  
  [FONT=&quot]           <mx:Button label="FullScreen" click="toggleFullScreen()" />[/FONT]
  [FONT=&quot]</mx:Application>[/FONT]
  

And this is my HTMLobject:

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

                                   <embed src="FullScreen.swf" quality="high" bgcolor="#869ca7"
                                              width="300" height="200" name="FullScreen" 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>
  </noscript>
  

The only thing I’ve done is this line: [COLOR=navy][FONT=&quot]<param[/FONT][/COLOR][COLOR=navy][FONT=&quot]name=[/FONT][/COLOR][COLOR=green][FONT=&quot]“allowFullScreen”[/FONT][/COLOR][COLOR=navy][FONT=&quot]value=[/FONT][/COLOR][COLOR=green][FONT=&quot]“true”[/FONT][/COLOR][COLOR=navy][FONT=&quot]/> [/FONT][/COLOR]and [COLOR=navy][FONT=&quot]allowFullScreen=[/FONT][/COLOR][COLOR=green][FONT=&quot]“true”

[/FONT][/COLOR]It don’t work, anyone who can help me?

Thank you