3 Replies Latest reply on Apr 28, 2009 1:30 PM by Flex harUI

    There is a very strange thing about Module~

    maniChina

      Thanks for your time to read my post~!

       

      I have an application as this:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="
      http://www.adobe.com/2006/mxml"
      layout="vertical"
      creationComplete="init();"
      verticalAlign="middle"
      >

      <mx:Script>
        <![CDATA[
         import mx.modules.ModuleLoader;
         private var mm:ModuleLoader;
         private var mm2:ModuleLoader;
        
         private function init():void
         {
         }
        
         private function add():void
         {
          if(!mm){
           mm = new ModuleLoader();
           mm.url = 'Test.swf';
          }
          if(!mm2){
           mm2 = new ModuleLoader();
           mm2.url = 'Test2.swf';
          }
          mm.loadModule();
          mm2.loadModule();
          this.addChild(mm);
          this.addChild(mm2);
         }
         private function remove():void
         {
          if(mm && mm2){
           mm.unloadModule();
           mm2.unloadModule();
           this.removeChild(mm);
           this.removeChild(mm2);
           mm = null;
           mm2 = null;
          }
         }
        ]]>
      </mx:Script>
      <mx:Button click="add();"/>
      <mx:Button click="remove();"/>
      </mx:Application>

      I want to test the ModuleLoader and Module. The Test.swf and Test2.swf just like this:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module xmlns:mx="
      http://www.adobe.com/2006/mxml" layout="vertical">

      <mx:Button label="1"/>
      <mx:TextArea />
      </mx:Module>

       

      There always is a instance of _Test_mx_core_FlexModuleFactory couldn't be removed, and it's back references is:

       

      Instance                                                                                Property

          

      _Test_mx_core_FlexModulefactory(3)

           Object                                                                                    fbs         

           Function(1)                                                                             [savedThis]

                _Text_mx_core_FlexModuleFactory                                     mx.core:FlexModuleFactory

           Function(2)

                _Test_mx_core_FlexModuleFactory

                flash.display:LoaderInfo                                                         [listener0]

       

      So could anybody tell me what's mean of this situation?

       

      Thanks in advance!!