1 Reply Latest reply on Oct 7, 2011 12:47 PM by Flex harUI

    Unloading Module Closing Multiple Custom Panels


      I have a requirement where in  same screen can be openned N times, i have written a custom panel (module loader inside it) with a close buttonn, to load the same module multiple times. The problem is when i close one panel all the panels are closed. The reason it is closing all the panels is i have included the removeChild inside unload tag of the module loader.


      I tried changing the "ml.unloadModule();" to "parent.removeChild(this);" then i acheive what is needed close only the panel that is closed, but the module it not unloaded. Is there any way i can acheive closing only a single panel (this is closed) and unload the module. 


      Below is the custom panel code:


      <?xml version="1.0" encoding="utf-8"?>
      <s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
                           xmlns:mx="library://ns.adobe.com/flex/mx" width="436" height="340">
                                    [Bindable]public var url:String;
                                    protected function button1_clickHandler(event:MouseEvent):void
                                              // TODO Auto-generated method stub 
                          <!-- Place non-visual elements (e.g., services, value objects) here -->
                <s:ModuleLoader x="10" y="9" id="ml" url="{url}" width="404" height="277">
                                    if(parent != null)
                <s:Button x="411" y="-23" width="17" height="16" label="Button"
                                      click="button1_clickHandler(event)" icon="assets/icon_close_down.png"/>