今天在adobe网站上无意中看到flex2.0可以不用javascript就可以简单的实现全屏
顺手记录下来供大家参考:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundGradientColors="[#8080ff, #400040]">
<mx:Script>
<![CDATA[
import flash.display.StageDisplayState;
private function toggle():void{
if(fs.selected == true){
this.goFullScreen();
} else {
this.exitFullScreen();
}
}
private function goFullScreen():void {
stage.displayState = StageDisplayState.FULL_SCREEN;
}
private function exitFullScreen():void {
stage.displayState = StageDisplayState.NORMAL;
}
]]>
</mx:Script>
<mx:Panel width="100%" height="100%" title="轻松实现全屏"
layout="absolute">
<mx:CheckBox label="全屏" id="fs" click="this.toggle()"
horizontalCenter="0" verticalCenter="0"/>
</mx:Panel>
</mx:Application>