creationComplete only gets dispatched when the 2nd child is created. The "show" event should work for subsequent times.
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Easy Flexing Sent: Friday, October 24, 2008 9:25 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Communicate between modules using module loader Module Loader and Application We use module loader to load our modules. In one of my case, one module loader (mod1) needs to communicate with the other module loader (mod2), so I am using Interface, ModuleLoadEvent.ready to do it. mod2 has a view stack and has 3 children. When module 1 calls module 2 I want to display the 2nd child and not the first. It works fine when mod2 is called for the first time from mod1 but when you try to call mod2 for the second time onChild2CreationComplete function is not called, hence the mod2 is empty. Below is the code that I am using. Any input is appreciated In Mod 1 //this function is called when mod 1 is created Private function onCreationComplete():void{ Application.application.appModuleLoader.removeEventListener("ready",loadClaim); Application.application.appModuleLoader.addEventListener("ready",loadClaim,false,0,true); } //When a button is pressed from mod1 to call mod2 private function callMod2():void{ Application.application.appModuleLoader.applicationDomain = ApplicationDomain.currentDomain; Application.application.appModuleLoader.url="mod2.swf"; } private function loadClaim(event:ModuleEvent):void{ Application.application.appModuleLoader.removeEventListener("ready",loadClaim); if(Application.application.appModuleLoader.initialized){ var ichild:* = Application.application.appModuleLoader.child as ModuleInterface.IView; if (ichild != null) { ichild.setComponent(arg1, arg2); } } } In Mod 2: //this is the function called from Mod1: public function setComponent(arg1:String,arg2:String):void{ if(child2){ viewstack.selectedChild = child2; selectedComponent = select; }else{ callLater(setComponent, new Array(arg1,arg2)); } } //this function is called when the child2 creation is completed. private function onChild2CreationComplete(event: Event):void{ ledgerViews.selectedChild = claim; }