flex全屏功能实现

我用的是flex4

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
 <fx:Declarations>
  <!-- 将非可视元素(例如服务、值对象)放在此处 -->
 </fx:Declarations>
 <fx:Script>
  <![CDATA[
   import mx.controls.Alert;  
   private function fullScr():void{  
    stage.displayState=StageDisplayState.FULL_SCREEN;  
    //controlScr.label="普通";  
    //controlScr.addEventListener(MouseEvent.CLICK, normalScr);  
    var contextMenu:ContextMenu=new ContextMenu();  
    contextMenu.hideBuiltInItems();  
    var item:ContextMenuItem=new ContextMenuItem("关于作者");  
    item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,alertMsg);  
    contextMenu.customItems.push(item);  
    this.contextMenu=contextMenu;  
   }  
   
   private function alertMsg(event:ContextMenuEvent):void{  
    Alert.show("hacker.Ye");  
   }  
   
   private function normalScr():void{  
    //controlScr.removeEventListener(MouseEvent.CLICK,fullScr);  
    stage.displayState=StageDisplayState.NORMAL;  
   }  

  ]]>
 </fx:Script>
 <s:HGroup width="100%">
  <s:Button label="全屏" click="fullScr();"/>  
  <s:Button  label="普通" click="normalScr()"/>
 </s:HGroup>
 
</s:Application>

 

源代码出处:http://www.iteye.com/topic/206857

你可能感兴趣的:(flex全屏功能实现)