Search Flex Components Free

Custom Search

December 27, 2007

Flex in FullScreen Mode

Fullscreen on clicking of a button:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”
http://www.adobe.com/2006/mxml ” layout=”absolute” applicationComplete=”init()”>
<mx:Script>
<![CDATA[
import flash.display.*;
import flash.events.FullScreenEvent;
// Status FULLSCREEN:
private var FullScreenStatus:Boolean = false;
private function init():void
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenRedraw);
}
private function fullScreenRedraw(event:FullScreenEvent):void
{
output.text = “FULLSCREEN Status: ” + String(event.fullScreen)

if (event.fullScreen == false)
disableFullScreen()
}
private function changeFullScreenStatus(e:MouseEvent):void
{
if(FullScreenStatus)
disableFullScreen()
else
enableFullScreen()
}
private function disableFullScreen():void
{
FullScreenStatus = false;
fullScreen_btn.label = “ENABLE FullScreen”;
fullScreen_btn.stage.displayState = StageDisplayState.NORMAL;
}
private function enableFullScreen():void
{
FullScreenStatus = true;
fullScreen_btn.label = “DISABLE FullScreen”;
fullScreen_btn.stage.displayState = StageDisplayState.FULL_SCREEN;
}
]]>
</mx:Script>
<mx:Button label=” FULLSCREEN” id=”fullScreen_btn” x=”46″ y=”35″ click=”changeFullScreenStatus(event)”/>
<mx:Text x=”56″ y=”65″ text=”FULLSCREEN Status” id=”output”/>
</mx:Application>

Fullscreen on Creation Complete:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”
http://www.adobe.com/2006/mxml ” layout=”absolute” creationComplete=”init()”>
<mx:Script>
<![CDATA[
import flash.system.fscommand;
private function init():void{
fscommand(”fullscreen”,”true”);
}
]]>
</mx:Script>
<mx:Button x=”90″ y=”45″ label=”Hello!”/>
</mx:Application>


Related Flex Tutorials