1 Replies - 1150 Views - Last Post: 30 April 2009 - 02:35 AM

#1 coden4fun  Icon User is offline

  • if(coden4fun.NotTired){ ContinueToCode(); }
  • member icon

Reputation: 28
  • View blog
  • Posts: 696
  • Joined: 27-February 09

Auto FullScreen & toggle Fullscreen w\button

Posted 16 March 2009 - 01:47 AM

Description: edit your Flex mx application as the code snippet suggest.Demonstrates how to have your Flex app auto-start in full screen mode.
//First add the following to your mx:Application tag  applicationComplete
//will call the function you pass it soon as your app is fired up.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
	layout="absolute"
	applicationComplete="init()"

//then add the following as your script
     <mx:Script>
        <![CDATA[
            //first your init function to initialize the application
            private function init():void
			{
				//once this triggers your displayState of your stage will automatically go to fullscreen
				Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;
			}

            //next create a toggle function for a button to switch between modes
            private function toggleFullScreen():void
			{
				try
				{
					switch(Application.application.stage.displayState)
					{
						case StageDisplayState.FULL_SCREEN:
							Application.application.stage.displayState = StageDisplayState.NORMAL;
							break;
						default:
							Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;
							break;
					}
				}
				//if we can't go fullscreen trace the error
				catch(err:SecurityError)
				{
					trace (err.message);
				}
			}
			
             ]]>
    </mx:Script>

<!--Finally outside of your script and back to the mxml add a button that will trigger toggleFullScreen like the following below-->
<mx:Button label="Toggle fullscreen" click="toggleFullScreen()" />





Is This A Good Question/Topic? 0
  • +

Replies To: Auto FullScreen & toggle Fullscreen w\button

#2 greatdragon  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 08-November 06

Re: Auto FullScreen & toggle Fullscreen w\button

Posted 30 April 2009 - 02:35 AM

produces error for me ...? in ebedded allowFullScreen is true even if i set a timer and wait 2 seconds and then set to fullscreen. if i go fullscreen by button.click - no problem - only if automatic! SecurityError: Error #2152 ... at flash.display::Stage/set displayState()
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1