`
lixinye0123
  • 浏览: 323452 次
  • 性别: Icon_minigender_1
  • 来自: 温州
社区版块
存档分类
最新评论

让Flex程序全屏幕运行

    博客分类:
  • Flex
阅读更多
例子代码如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init()">

    
<mx:Script>
        
<![CDATA[
            import flash.display.StageDisplayState;
            import mx.managers.SystemManager;
            import flash.events.FullScreenEvent;
            private function init():void {
                /* Set up full screen handler. */
                systemManager.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);
                dispState = systemManager.stage.displayState;
            }

            private function fullScreenHandler(evt:FullScreenEvent):void {
                dispState = systemManager.stage.displayState + " (fullScreen=" + evt.fullScreen.toString() + ")";
                if (evt.fullScreen) {
                    /* Do something specific here if we switched to full screen mode. */
                } else {
                    /* Do something specific here if we switched to normal mode. */
                }
            }

            private function toggleFullScreen():void {
                try {
                    switch (systemManager.stage.displayState) {
                        case StageDisplayState.FULL_SCREEN:
                            /* If already in full screen mode, switch to normal mode. */
                            systemManager.stage.displayState = StageDisplayState.NORMAL;
                            break;
                        default:
                            /* If not in full screen mode, switch to full screen mode. */
                            systemManager.stage.displayState = StageDisplayState.FULL_SCREEN;
                            break;
                    }
                } catch (err:SecurityError) {
                    // ignore
                }
            }
        
]]>
    
</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>
 
然后修改生成的html:
AC_FL_RunContent(
            
"src""TestFullScreen",
            
"width""100%",
            
"height""100%",
            
"align""middle",
            
"id""TestFullScreen",
            
"quality""high",
            
"bgcolor""#869ca7",
            
"name""TestFullScreen",
            
"allowScriptAccess","sameDomain",
            
"allowFullScreen","true",
            
"type""application/x-shockwave-flash",
            
"pluginspage""http://www.adobe.com/go/getflashplayer"
    );
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
            id
="TestFullScreen" width="100%" height="100%"
            codebase
="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
            
<param name="movie" value="TestFullScreen.swf" />
            
<param name="quality" value="high" />
            
<param name="bgcolor" value="#869ca7" />
            
<param name="allowScriptAccess" value="sameDomain" />
            
<param name="allowFullScreen" value="true" />
            
<embed src="TestFullScreen.swf" quality="high" bgcolor="#869ca7"
                width
="100%" height="100%" name="TestFullScreen" align="middle"
                play
="true"
                loop
="false"
                quality
="high"
                allowScriptAccess
="sameDomain"
                allowFullScreen
="true"
                type
="application/x-shockwave-flash"
                pluginspage
="http://www.adobe.com/go/getflashplayer">
            
</embed>
    
</object>

加入红色的内容即可
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics