The module manager knows what modules have been loaded, but it doesn't
provide an iterator.
 
If you know the URLs, you can check a given module's load status.  It is
harmless (other than creating some cached state) to probe a given URL
before you call "load".
 
Removing the tab (and ensuring that you have no other references to the
child control) will only cause instance data to be GC'ed, not the
underlying bytecode.
 
The module's code will never get fully recycled unless you call
"unload", because there is a ModuleInfo reference handing onto its
internal module class factory (in case there is a subsequent need to
reuse it).
 
-rg


________________________________

        From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of aaronvm707
        Sent: Monday, March 05, 2007 10:40 AM
        To: flexcoders@yahoogroups.com
        Subject: [flexcoders] Re: Managing Multiple Modules
        
        

        Roger, thank you for your quick response.
        
        Does the module factory hold information (module ID, URL etc...)

        about the modules I have loaded?
        
        How important is it to unload modules? If I remove a specific
tab 
        from the navigator will GC eventually clean up the child module
on 
        that tab?
        
        Aaron
        
        --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "Roger Gonzalez" <[EMAIL PROTECTED]> 
        wrote:
        >
        > 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: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
        > [mailto:flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> ] On Behalf Of aaronvm707
        > Sent: Sunday, March 04, 2007 10:13 PM
        > To: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
        > 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
        >
        
        

         

Reply via email to