Quick Tip: ModuleEvent.Ready not firing
public function loadModule(objEvent:Event):void
{
var objModuleInfo:IModuleInfo = ModuleManager
.getModule("module/ModuleViewA.swf");
objModuleInfo.addEventListener(ModuleEvent.READY, onModuleReady);
objModuleInfo.addEventListener(ModuleEvent.ERROR, onModuleLoadError);
objModuleInfo.load();
}
The above code must be familiar to you when you try loading Module using ModuleManager (flex sdk 3.4). But ModuleEvent.READY won’t fire. Why? because the IModuleInfo object above has local scope and ModuleManager maintains weak references to this object. By the time module loading completes it gets Garbage Collected
.
Solution: Maintain the reference to the IModuleInfo object by making it a member variable.
Recent Comments