Skip navigation
Currently Being Moderated

loading and unloading Modules

Aug 6, 2009 8:06 AM

I am using ModuleLoader to load  swf files in my application as follows:-

 

 

 

 

 

 

 

 

private

 

 

function loadModule(modulName:String):void

{

    moduleInfo = ModuleManager.getModule(modulName);

    moduleInfo.addEventListener(ModuleEvent.READY, renderModule);

    moduleInfo.addEventListener(ModuleEvent.ERROR, handleError);

    moduleInfo.load();

}

 

 

 

private function renderModule(event:ModuleEvent):void

{

    moduleToBeLoaded = moduleInfo.factory.create()

as Module;

    moduleToBeLoaded.width = containrOfTheModule.width;

    moduleToBeLoaded.height = containrOfTheModule.height;

    containrOfTheModule.addChild(moduleToBeLoaded);

}

 

 

The call to loadModule is made as follows:-

loadModule(

"SummaryApplication.swf");

 

So far so good.  The problem is that when I unload a module, I don't think it is being unloaded properly since I cannot see the reduction in the memory usage.  On the contrary what I am seeing is a continuous increase in the memory as these modules are loaded and unloaded.  So if I continue switching between two swf files, the memory footprint continues to increase.  Unload is as follows:-

 

 

 

 

 

 

 

 

 

private

 

 

{

 

 

     if(null!=containrOfTheModule){

 

 

function unloadSWF():void

          containrOfTheModule.removeAllChildren();

 

 

 

null;

 

 

           trace("unloading");

     }

 

 

     if(null!=moduleInfo){

          moduleInfo.unload();

     }

}

 

 

 

 

Please advise how can I fix this?

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points