info.removeEventListener(ModuleEvent. READY, modEventHandler)?? before setting it to null HTH, Claudiu
________________________________ From: rockorgames <[email protected]> To: [email protected] Sent: Saturday, December 27, 2008 9:20:13 PM Subject: [flexcoders] unload module but flexmodulefactory remains ? hm i have this sample app where it simples loads/unloads a simple module.. when executing in profiler the instance of the module "a" gets removed without a problem.. but the instance of _a_mx_core_flexmodu lefacto ry only goes up.. when first start the app the instance of _a_mx_core_flexmodu lefacto ry is 1.. if i remove the module.. the instance of "a" goes to 0 but the flexmodulefactory instance doesnt.. if i keep on adding and removing the module the flexmodulefactory instance never goes down... in a larger app this will be a problem.. anyone knows whats wrong here ? app: <?xml version="1.0" encoding="utf- 8"?> <mx:Application creationComplete= "init()" xmlns:mx="http: //www.adobe. com/2006/ mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.events.ModuleEve nt; import mx.modules.ModuleMa nager; import mx.modules.IModuleI nfo; public var info:IModuleInfo; public var xi:Module; private function init():void { info = ModuleManager. getModule( "a.swf"); info.addEventListen er(ModuleEvent. READY, modEventHandler) ; info.load(); } private function modEventHandler( e:ModuleEvent) :void { xi = info.factory. create() ; addChild(xi) ; } public function remove():void { removeChild( xi); info.unload( ); info = null; xi=null; } ]]> </mx:Script> <mx:Button x="200" y="176" id="lasal" label="add" click="init( )"/> <mx:Button x="486" y="176" id="laal" label="remove" click="remove( )"/> </mx:Application> module: <?xml version="1.0" encoding="utf- 8"?> <mx:Module remove="parentAppli cation.setFocus( )" xmlns:mx="http: //www.adobe. com/2006/ mxml" layout="absolute" width="400" height="300"> <mx:TextInput id="la"> </mx:TextInput> </mx:Module>

