<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientColors="[#294B88, #3F7ACA]" color="#FFFFFF">
<mx:Script>
<![CDATA[
private function fullScreen(evt:MouseEvent):void{
if (this.stage.displayState == StageDisplayState.FULL_SCREEN){
this.stage.displayState = StageDisplayState.NORMAL;
stage.scaleMode = StageScaleMode.NO_SCALE;
fullscr.label = '全屏' ;
}else{
this.stage.displayState = StageDisplayState.FULL_SCREEN;
stage.scaleMode = StageScaleMode.NO_SCALE;
fullscr.label = '退出全屏' ;
}
}
]]>
</mx:Script>
<mx:Canvas width="100%" height="6%" backgroundColor="#131A2C" backgroundAlpha="0.9">
<mx:Button id="fullscr" width="80" height="30" x="30" y="4" label="全屏模式" click="fullScreen(event)"/>
</mx:Canvas>
</mx:Application>
全屏报 “SecurityError:Error #2152:不允许使用全屏模式” 的错误。
是因为需要在修改FLex项目下html-template文件夹下的xxx.template.html文件:
在两个AC_FL_RunContent方法里加入:
"allowFullScreen", "true"
保存,收工。