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_flexmodulefactory
only goes up..

when first start the app the instance of  _a_mx_core_flexmodulefactory
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.ModuleEvent;
         import mx.modules.ModuleManager;
         import mx.modules.IModuleInfo;

         public var info:IModuleInfo;
         public var xi:Module;
         private function init():void
         {
              info = ModuleManager.getModule("a.swf");
             info.addEventListener(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="parentApplication.setFocus()"
xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" width="400"
height="300">

<mx:TextInput id="la">

</mx:TextInput>
</mx:Module>


Reply via email to