Fuzzo wrote:
> 
> Hi all!
> 
> I'm writing a modular application that loads a module. This module inside
> has a Timer that trace something every 5 seconds.
> When from application i "exit" (unload) the module, i have no error but i
> see the writing done by the module that should be unloaded!
> 
> It means that the module is alive? How can i "destory" the module and all
> it's children for sure?
> 
> Thanks a lot!
> 
> P.S.: I tried both ModuleLoader and ModuleManager with the same beaviour
> :(
> 
> 

I've build a simple exemple of this issue:

******************************************************

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
initialize="init()">
<mx:Script>
        <![CDATA[
                private function init():void {
                        //trace("APP STARTED");
                }
                
                private function load(e:MouseEvent):void {
                        ml.url = modName.text;          
                }
                
                private function unload(e:MouseEvent):void {
                        ml.unloadModule();      
                }
                
                private function nullify(e:MouseEvent):void {
                        ml.url = null;  
                }
                
                private function remove(e:MouseEvent):void {
                        ml.removeAllChildren();
                }

        ]]>
</mx:Script>

        <mx:VBox>
        <mx:HBox>
                <mx:TextInput id="modName" text="TimerModule.swf" />
                <mx:Button label="Load" click="load(event)"/>
                <mx:Button label="Unload" click="unload(event)"/>
                <mx:Button label="Nullify" click="nullify(event)" />
                <mx:Button label="RemoveChild" click="remove(event)" />
                <mx:Button label="GC" click="System.gc()" />
        </mx:HBox>      
        <mx:ModuleLoader id="ml" height="100%" width="100%" />
        </mx:VBox>
        
</mx:Application>

******************************************************

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
width="400" height="300"
        initialize="init()">
        <mx:Script>
                <![CDATA[
                
                        private var count:uint = 0;
                        private var t:Timer = new Timer(5000);
                
                        private function init():void {
                                t.addEventListener(TimerEvent.TIMER, tick);
                                t.start(); 
                        }
                        
                        private function tick(e:TimerEvent):void {
                                trace("REFRESH " + (++count));
                                txt.text = txt.text + "\n" + "REFRESH " + count;
                        }
                ]]>
        </mx:Script>
        <mx:TextArea id="txt" height="100%" width="100%"/>
        
        
</mx:Module>

******************************************************

If you launch it in debug mode, you'll see all the stuffs... :(
-- 
View this message in context: 
http://www.nabble.com/ModuleLoader-does-not-unload-anything-%3A%28-tp24186501p24198697.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to