2012-05-27 50 views
0

打開的模塊,我新的彎曲,我試圖在新窗口模式打開模塊。 我已成功地加載,並添加在容器(VBOX)的模塊,但我真正需要的是在單獨的窗口中打開它們。 我能找到的所有文章都是關於如何加載模塊的示例,但沒有介紹如何顯示它們。 我發現這裏後 Modules and Panels issue ,它看起來的正是我要找的屏幕截圖。柔性4 AIR應用程序在一個新的模式窗口

感謝您的幫助。

+0

當您說「模塊」是指實際的模塊(http://livedocs.adobe.com/flex/3/html/help.html?content=modular_5.html),它們真的很像單獨的應用程序;或者您是否一般使用該術語來指代不同的視圖?當你說新窗口你是指一個新的瀏覽器窗口?或者你的應用程序的新實例?或者只是一個窗口仍然包含在同一個應用程序中,但駐留在上面? – JeffryHouser

+0

我在說真實模塊是的。 – gfbaggio

+0

這仍然是包含在同一個應用程序,並駐留在它上面的窗口,是 – gfbaggio

回答

0

我發現這樣做的方式。 感謝所有的指針

這裏是我是如何做到的各位看,也許使用。如果您有任何改進建議,請不要猶豫,發表評論。

我使用的組件:collapsabletitlewindow

mainapp.mxml

<?xml version="1.0" encoding="utf-8"?> 
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx" 
    xmlns:components="de.aggro.components.*"> 
<fx:Script> 
<![CDATA[ 

import de.aggro.components.*; 

private function createWindow():void{ 
var w:window = new window; 
w.title = "Window " + container.numChildren; 
container.addChild(w); 
} 
]]> 
</fx:Script> 
<components:CollapsableTitleWindowContainer id="container" width="100%" height="100%" > 
</components:CollapsableTitleWindowContainer> 
<s:Button buttonDown="createWindow()" label="Create Window" /> 
<fx:Declarations> 
<!-- Place non-visual elements (e.g., services, value objects) here --> 
</fx:Declarations> 
</s:WindowedApplication> 

window.mxml

<?xml version="1.0" encoding="utf-8"?> 
<components:CollapsableTitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:components="de.aggro.components.*"  layout="absolute" width="400" height="300" 
    creationComplete="initApp()" > 
<fx:Script> 
<![CDATA[ 
import mx.events.ModuleEvent; 
import mx.modules.ModuleManager; 
import mx.modules.IModuleInfo;   
import mx.core.IVisualElement; 

public var info:IModuleInfo; 

private function initApp():void { 
info = ModuleManager.getModule("mod.swf"); 
info.addEventListener(ModuleEvent.READY, modEventHandler);   

/* Load the module into memory. Calling load() makes the 
IFlexModuleFactory available. You can then get an 
instance of the class using the factory's create() 
method. */ 
info.load(null, null, null, moduleFactory); 
} 

/* Add an instance of the module's class to the display list. */   
private function modEventHandler(e:ModuleEvent):void { 

this.addElement(info.factory.create() as IVisualElement); 
} 
]]> 
</fx:Script> 
<fx:Declarations> 
<!-- Place non-visual elements (e.g., services, value objects) here --> 
</fx:Declarations> 

</components:CollapsableTitleWindow> 

mod.mxml

<?xml version="1.0" encoding="utf-8"?> 
<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"> 
<fx:Declarations> 
<!-- Place non-visual elements (e.g., services, value objects) here --> 
</fx:Declarations> 
<mx:LinkButton x="131" y="124" label="Module link"/> 
</s:Module> 
相關問題