hmm, bei mir geht das so:
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.events.ModuleEvent;
import mx.modules.ModuleManager;
import mx.modules.IModuleInfo;
private var mi_0 : IModuleInfo;
private var mi_1 : IModuleInfo;
private var module0 : Module1;
private var module1 : Module2;
private function loadModules():void{
this.mi_0 = ModuleManager.getModule( "Module1.swf" );
this.mi_0.addEventListener( ModuleEvent.READY, listener );
this.mi_0.load();
}
private function listener(event:ModuleEvent):void{
trace("module1 loaded")
this.module0 = IModuleInfo(event.currentTarget).factory.create() as Module1;
this.module0.x = this.butn0.x;
this.module0.y = 100;
this.addChild( this.module0 );
this.butn0.enabled = true;
}
]]>
</mx:Script>
<mx:Button x="10" y="10" label="loadModules" click="loadModules()"/>
<mx:Button x="10" y="465" label="getSomeData Module1" id="butn0" enabled="false" click="this.text0.text = this.module0.getSomeData()"/>
<mx:TextArea x="10" y="495" id="text0"/>
</mx:Application> Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300">
<mx:Script>
<![CDATA[
private var _someData : String = "someDataFromModule1";
public function getSomeData():String{
return this._someData;
}
]]>
</mx:Script>
<mx:Label x="10" y="10" text="Module1"/>
<mx:Canvas x="10" y="36" width="200" height="200" backgroundColor="#C80909">
</mx:Canvas>
</mx:Module>