How to remove or unload an externally loaded swf file from your project?
It happenes a lot that you try to load an external SWF file into your project. maybe in your portfolio or some swf movies or sound files. The problem I am going to talk about here is about the common problem of unloading the swf files!
you see, if you have loaded an swf file which has some music on it playing constantly, when you try to unload/remove that swf, the sound keeps playing! (not just sounds, maybe some Event.ENTER_FRAME or other listeners are still working)
to avoid this problem, the best solution I can think of is to add a REMOVED_FROM_STAGE listener in your external swf file so it can listen to when it’s removed from the stage so it can kill the running processes inside itself.
simply add it like this:
[cc lang="php" line_numbers="true" nowrap="false" width="100%"]
// kill all listeneres and running processes here.