The URL for a given module is a unique key for the module at that URL,
no matter how many times you get it. Each time you get a ModuleInfo,
you can use it to request an unload. (Note that unload just makes
things available for GC, it does not force things to unload.)
There's no reason why you need to always put the module info into a
single variable though, of course its going to get overridden. You
could always keep an array of module infos. Or, you can just call
getModule again. No big deal.
-rg
________________________________
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of aaronvm707
Sent: Sunday, March 04, 2007 10:13 PM
To: [email protected]
Subject: [flexcoders] Managing Multiple Modules
Hello, I am trying to create an application that has a tab
navigator
that gets loaded with different modules, similar to a browser
window
opening multiple tabs. I have tried different methods but do not
know
how to get a reference to a module to unload it once multiple
modules
have been loaded. This is the code I am using to load the
modules:
public var info:IModuleInfo;
private function LoadModule(strUrl:String):void
{
info = ModuleManager.getModule(strUrl);
info.addEventListener(ModuleEvent.READY, modEventHandler);
info.load();
}
private function modEventHandler(e:ModuleEvent):void
{
var m:Module = info.factory.create() as Module;
myTabs.addChild(m);
}
This code works very well to load as many modules as I need. The
problem is the public var info gets updated as each new module
get
loaded. So I do I get an IModuleInfo object for a module that
has
already been loaded that I can then call the unload() method.
Please
any help or suggestions would be greatly appreciated. Thanks
Aaron