I can sure. Because if getModule return a unvalid value the next sentence will
be going wrong.
I use the Flex4 SDK. Is that make thing complexed?
protected function application_initializeHandler():void
{
module = ModuleManager.getModule("modules/workalert_mod.swf");
module.addEventListener(ModuleEvent.READY, moduleReadyHandler);
module.load();
}
/* it doesn't run actually*/
private function moduleReadyHandler(e:ModuleEvent):void{
switch(module.url){
case "module/workalert_mod.swf":
AllStaffLoader.removeAllChildren();
AllStaffLoader.addChild(module.factory.create() as DisplayObject);
break;
}
}
<mx:ModuleLoader
id="AllStaffLoader" width="100%" height="292"
x="0" y="475" x.workAlert="1" y.workAlert="478"/
在2009-06-29,"claudiu ursica" <[email protected]> 写道:
Your code looks fine to me... Are you sure the getModule() returns a valid
instance??
C
From: j2me_soul <[email protected]>
To: flexcoders <[email protected]>
Sent: Monday, June 29, 2009 2:28:25 PM
Subject: Re:Re: [flexcoders] How to use modulemanger to load modules
If I declare a moduleloader object in mxml it works.
<mx:ModuleLoader url="modules/ workalert_ mod.swf"
id="AllStaffLoader" width="100%" height="292"
x="0" y="475" x.workAlert= "1" y.workAlert= "478"/>
But I want to dynamically load a module, so I try to do this using
modulemanager.
private var WorkAlert:Class;
protected function application_ initializeHandle r():void
{
module = ModuleManager. getModule( "modules/ workalert_ mod.swf") ;
/* the event never dispatch, Why ? */
/* I can't do angthing, because there is no error at runtime at all */
module.addEventList ener(ModuleEvent .READY, moduleReadyHandler) ;
module.load( );
}
在2009-06-29,"claudiu ursica" <the_braniak@ yahoo.com> 写道:
There is this document issued by adobe where they explain with examples how to
handles modules ...
http://blogs. adobe.com/ flexdoc/pdfs/ modular.pdf
TH,
C
From: j2me_soul <j2me_s...@163. com>
To: flexcoders <flexcod...@yahoogro ups.com>
Sent: Monday, June 29, 2009 1:53:37 PM
Subject: [flexcoders] How to use modulemanger to load modules
How to load a module ?
200万种商品,最低价格,疯狂诱惑你
200万种商品,最低价格,疯狂诱惑你