2 Replies Latest reply on Nov 12, 2007 8:53 AM by joeflashTO

    removeChild and unload

      It seems like the removeChild and unload method do the same thing. Is it necessary to do both when you're removing the display of an external swf from the stage?

      Also, after loading in an external file then running code to remove it, whether you use removeChild, unload, or both, the sound will continue even though the movie is removed from the DisplayList/stage. I've found a workaround which is using Loader.content with the stop method and it works fine. However I am wondering why the sound would continue even though removeChild and/or unload removes the movie from the DisplayList/stage.

        • 1. Re: removeChild and unload
          kglad Adobe Community Professional & MVP
          you should stop all streams and connections, remove all listeners (even weakly referenced ones) and unload() your loader. and it wouldn't hurt to remove your loader from the display list, but nothing should be displayed after your loader's content is unloaded.
          • 2. Re: removeChild and unload
            The only way the Flash player will stop a sound from an external SWF is by properly garbage collecting the sound object and all of its events. This will only be done when there is absolutely nothing referencing the object or any of its events.

            The difference between removeChild and unload, is that unload removes the content of the loader object, whereas removeChild can potentially remove the loader object itself from the display list.