0 Replies Latest reply on Jul 8, 2008 2:53 AM by SWiiT

    Problems with unloading a module.

    SWiiT Level 1
      Hi.
      I have a problem when i want to unload a module.

      the code looks like this.
      --------------------------------- In the mx:Application ------------------------

      protected var menuAppLoader:ModuleLoader;

      public function addWindow(appLink:String,windowTitle:String,appLoader:String):void {
      var win:MDIWindow = new MDIWindow();
      menuAppLoader = new ModuleLoader();
      menuAppLoader.url = appLink;
      menuAppLoader.percentWidth = 100;
      menuAppLoader.percentHeight = 100;
      menuAppLoader.addEventListener("close", closeModule);
      menuAppLoader.loadModule();
      win.addChild(menuAppLoader);
      }

      private function closeModule(e:Event):void{
      systemLogger("Closing a window" + e.target);
      menuAppLoader.unloadModule();

      }

      --------------------------------- In the mx:Module ------------------------
      public function settings():void{

      this.addEventListener(Event.REMOVED_FROM_STAGE, closeHandler);
      }

      private function closeHandler(e:Event):void {
      parentApplication.systemLogger('edit_user close');
      this.dispatchEvent(new Event("close",true,true));
      }

      ---------------------------------------------------------
      When i am closing the module with the X button the hole IE is closing.

      Any one have a solution for my problem.
      I just want to close the window so i can reopen it later.

      I have findout that it only will unload the last module. So if i have opened 2 modules and want to close the first then IE closes but if i close the last module nothing is hapening.

      Thanks for help.