<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init(event)" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import flash.display.StageDisplayState;
private function init(evt:Event):void {
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) {
} else {
}
}
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;
}
} catch (err:SecurityError) {
}
}
]]>
</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>