lixinye0123 发表于 2013-1-29 07:41:12

Flex程序的全屏幕显示

看到官方的一片讲解如何在Flash Player 9下全屏幕显示Flash的文章,原文地址如下: Exploring full-screen mode in Flash Player 9 ,照葫芦画弧,这里我只贴一下AS3的代码:


<div style="">http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifpackage
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    import flash.display.Sprite;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    import flash.ui.ContextMenu;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    import flash.ui.ContextMenuItem;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    import flash.events.ContextMenuEvent;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    import flash.display.StageScaleMode;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    import flash.display.StageDisplayState;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    import flash.system.Security;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    import flash.system.SecurityPanel;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    import flash.system.fscommand;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    public class FullScreen_demo extends Sprite
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif    ...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif      public function FullScreen_demo()
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif      ...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            // create the context menu, remove the built-in items,
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            // and add our custom items
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            var fullscreenCM:ContextMenu = new ContextMenu();
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            fullscreenCM.addEventListener(ContextMenuEvent.MENU_SELECT, menuHandler);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            fullscreenCM.hideBuiltInItems();
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            var fs:ContextMenuItem = new ContextMenuItem("Go Full Screen" );
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            fs.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, goFullScreen);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            fullscreenCM.customItems.push( fs );
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            var xfs:ContextMenuItem = new ContextMenuItem("Exit Full Screen");
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            xfs.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, exitFullScreen);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            fullscreenCM.customItems.push( xfs );
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            // finally, attach the context menu to a movieclip
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            this.contextMenu = fullscreenCM;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif      }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif      
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif      private function goFullScreen(e:ContextMenuEvent):void...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            this.stage.displayState = StageDisplayState.FULL_SCREEN; //设置为全屏
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif      }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif      private function exitFullScreen(e:ContextMenuEvent):void...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            this.stage.displayState = StageDisplayState.NORMAL;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif      }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif      private function menuHandler(e:ContextMenuEvent):void...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            if (stage.displayState == StageDisplayState.NORMAL)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif               ...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif                  e.target.customItems[0].enabled = true;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif                  e.target.customItems[1].enabled = false;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif               }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif               else
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif               ...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif                  e.target.customItems[0].enabled = false;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif                  e.target.customItems[1].enabled = true;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif               }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif      }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif    }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif}
页: [1]
查看完整版本: Flex程序的全屏幕显示