关于flex MDI的应用

 首先,到 http://code.google.com/p/flexmdi/下载swc包,放在下面libs下,

如果是flex web项目,放在flex_libs下

/*==========静态加载mdi=================**/

view plain copy to clipboard print ?
  1. <!--必须使用MDICanvas画布-->  
  2.     <flexmdi:MDICanvas id="mdiCanvas" horizontalScrollPolicy="off" verticalScrollPolicy="off"  
  3.             width="100%" height="100%" backgroundColor="#FC9874" backgroundAlpha="0">  
  4.               
  5.             <mx:Button x="62" y="48" label="打开新窗体" click="show()"/>  
  6.             <!--必须使用MDIWindow-->  
  7.             <flexmdi:MDIWindow id="win2" title="Window 2" x="214" y="10" width="500" height="300" borderColor="#A9D3FB" barColor="red" cornerRadius="10"  layout="absolute">  
  8.                 <!--加载自己的swf-->     
  9.                 <mx:SWFLoader source="AdvenceDG.swf" width="100%" height="100%"/>  
  10.             </flexmdi:MDIWindow>  
  11.               
  12.         </flexmdi:MDICanvas>  
<!--必须使用MDICanvas画布--> <flexmdi:MDICanvas id="mdiCanvas" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="100%" height="100%" backgroundColor="#FC9874" backgroundAlpha="0"> <mx:Button x="62" y="48" label="打开新窗体" click="show()"/> <!--必须使用MDIWindow--> <flexmdi:MDIWindow id="win2" title="Window 2" x="214" y="10" width="500" height="300" borderColor="#A9D3FB" barColor="red" cornerRadius="10" layout="absolute"> <!--加载自己的swf--> <mx:SWFLoader source="AdvenceDG.swf" width="100%" height="100%"/> </flexmdi:MDIWindow> </flexmdi:MDICanvas>

/*==========动态加载mdi=================**/

view plain copy to clipboard print ?
  1. import mx.controls.SWFLoader;  
  2.             import mx.controls.Alert;  
  3.             import flexmdi.effects.effectsLib.MDIVistaEffects;  
  4.               
  5.               
  6.             import flexmdi.containers.MDICanvas;  
  7.             import flexmdi.containers.MDIWindow;  
  8. private function show():void  
  9.             {  
  10.                  mdi=new MDIWindow();  
  11.                 mdi.width=500;  
  12.                 mdi.height=400;  
  13.                   
  14.                 var swf:SWFLoader=new SWFLoader();  
  15.                 swf.source="WindowFrame.swf";  
  16.                 swf.percentWidth=100;  
  17.                 swf.percentHeight=100;  
  18.                 mdi.addChild(swf);  
  19.                           
  20.                 //右键菜单   
  21.                 var cm:ContextMenu=new ContextMenu();  
  22.                 cm.hideBuiltInItems();  
  23.                 var menu:ContextMenuItem=new ContextMenuItem("最小化");  
  24.                 menu.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,maxHandle);  
  25.                 cm.customItems.push(menu);  
  26.                 mdi.contextMenu=cm;  
  27.                 //////////////////   
  28.                 this.mdiCanvas.windowManager.add(mdi);  
  29.                   
  30.                   
  31.             }  

你可能感兴趣的:(关于flex MDI的应用)