0

私はフレックスが初めてで、モジュールを新しいウィンドウモーダルで開こうとしています。コンテナー ( vbox ) にモジュールをロードして追加することができましたが、本当に必要なのは、それらを別のウィンドウで開くことです。私が見つけたすべての投稿は、モジュールをロードする方法のサンプルですが、それらを表示する方法については何もありません。こちらのモジュールとパネルの問題の投稿を見つけました 。スクリーンショットを見ると、探しているものとまったく同じように見えます。

ご協力いただきありがとうございます。

4

1 に答える 1

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>
于 2012-06-02T01:08:00.010 に答える