1 Reply Latest reply on Nov 20, 2010 3:54 PM by drkstr_1

    addChild x removeChild

    giba_f

      Hello !

       

      I have a main mxml which is a component in addChild in the following section and then opens a window of a second mxml, and in this second open mxml, mxml need removeChild that the principal added. but how?

       

       

      Thanks.

       

      Gilberto

        • 1. Re: addChild x removeChild
          drkstr_1 Level 4

          Some would consider a child removing a sibling from it's parent to be poor OOP design.

           

          Instead of putting the removeChild code in the window, have it dispatch a custom event. The parent should listen for that event when it opens the window, and handle it accordingly. Don't forget to remove the event listener when the window is closed, or you could have garbage collection issues.