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