as3 unload swf problem

May 6th, 2008

Started having problems with some audio playing at weird times and events firing strangely in some swfs I had loading into a host clip. Really pissed me off and I didn’t really know what was going on until I saw this article. Cmon adobe. AS3 was supposed to make things simpler, not the usual haxxor your way around the weird player issues. addChild == nice. Having to force and animator to write disassemblers = not so nice. Didn’t take long to find a workaround once I saw this article, but my hours of struggling with Loader.unload() really sucked.

4 Responses to “as3 unload swf problem”

  1. Nina Says:

    What did you use as a workaround for this issue?

  2. pixelrevision Says:

    My workaround for this particular project was to never unload the stuff. Instead I built a function that would start each loaded item over from scratch. It seemed like if I let the clip sit there sounds would stop properly, but if I tried to remove all references to the loaded content, sounds would keep playing. My solution was not a good one and would be problematic for a larger scale project.

  3. lulemon Says:

    Would you be able to share your code of the workaround? I’m urgently looking for one. I know Flash 10 has a better function but I must develop in Flash 9 for the client.

    Thanks,

  4. pixelrevision Says:

    So far the only thing I have been able to do is make sure that the people making the files follow certain guidelines. A HUGE thing is to make sure that any event listeners that are in the loaded files use weak references. This will knockout 99% of the problems you run across. Anything having to do with sound or things like enterframe events will need a method in the loaded file to get them stopped. Avoiding any references in your host file is really important as well. If you declared a variable that touches anything in the loaded file, chances are you need to clean it up.

Leave a Reply