I was able to reproduce the issue using your test case. I am not sure if it is by design. Please submit a bug.
Also the issue gets resolved if you call Info.load() - without specifying the application domain. Thanks, Gaurav -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Broce Sent: Sunday, March 02, 2008 2:56 PM To: [email protected] Subject: [flexcoders] Re: Module unloads but FlexModuleFactory instance does not unload Listed below is a simple Module loading example that demonstrates the problem (source code at bottom). Create a new Flex project and set FlexApp.mxml as the "Main application file" and add TestModule.mxml as a Module. To verify that the _TestModule_mx_core_FlexModuleFactory "factory" instance is NOT getting unloaded, perform these steps: 1) Launch profiler and wait for FlexApp to load 2) Before clicking "Load Module", take a Memory Snapshot. 3) Click "Load Module" and wait for TestModule to load (its a green square). 4) Click "Unload Module" and TestModule unloads. 5) Take a 2nd Memory Snapshot. 6) Select both Memory Snapshots and click "Find Loitering Objects". You should see _TestModule_mx_core_FlexModuleFactory in the Loitering Objects list. You can double-click _TestModule_mx_core_FlexModuleFactory to obtain further details. I want to confirm that someone else can reproduce this issue before I submit a bug to Adobe. I also want to confirm that this behavior is not by design. Does anyone have any suggestions as to why this happens and possible work arounds? Note: I am using Flex Builder 3.0 (release). Thanks! ---------------------------- FlexApp.mxml ---------------------------- <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Script><![CDATA[ import mx.events.ModuleEvent; import mx.modules.*; private var Info:IModuleInfo; private var Instance:Module; private function LoadModule():void { Info = ModuleManager.getModule( "TestModule.swf" ); Info.addEventListener( ModuleEvent.READY, ModuleReady ); //Info.load(); Info.load( ApplicationDomain.currentDomain ); } private function UnloadModule():void { removeChild( Instance ); Info.removeEventListener( ModuleEvent.READY, ModuleReady ); Info.unload(); Info = null; Instance = null; } private function ModuleReady( e:ModuleEvent ):void { Instance = Info.factory.create() as Module; addChild( Instance ); } ]]></mx:Script> <mx:Button id="Button1" label="Load Module" click="LoadModule ()" /> <mx:Button id="Button2" label="Unload Module" click="UnloadModule()" /> </mx:Application> ---------------------------- TestModule.mxml ---------------------------- <?xml version="1.0" encoding="utf-8"?> <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="200" height="200" backgroundColor="#BBF2A2"> </mx:Module> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links

