tags:

views:

753

answers:

1

I have an app with several modules. There is only one module loaded at anyone time. 2 out of the 3 modules load without problems but the third a new module will not fire the ModuleEvent.Ready. I have an event handler function that handles the ModuleEvent.PROGRESS and it just traces out the bytes loaded vs bytes total. It seems to load the module completely yet never fires the ready event. Here is how I am loading the modules:

 public var moduleInfo:IModuleInfo;

    public function loadModule(url:String):void{

         if(moduleInfo != null)
         moduleInfo.release();  

          moduleInfo = ModuleManager.getModule(url+"?"+"x="+Math.random().toString());
          moduleInfo.addEventListener(ModuleEvent.READY,moduleLoadHandler,false,0,true);
          moduleInfo.addEventListener(ModuleEvent.PROGRESS,onModuleProgress,false,0,true);
          moduleInfo.load(ApplicationDomain.currentDomain);

        }
A: 

Ok, turns out it has been a long time since I created a new module. I forgot one critical thing. Since my modules are in separate projects, I need to change the root tag of the main mxml file from Application to Module. :)

Live and learn and never be ashamed to admit when you are wrong.

smartdirt