Objects removed at any key
frame therefore should be eligible for garbage collection, assuming no event
listeners or other code created a reference to them.
Yes.

Another problem is: even if no listener or code references to these objects, they continue "playing" when they are removed by a blank keyframe. "playing" means that if the playhead was in play mode, the playhead continues playing, possibly triggering sounds, scripts, etc... :(

It seems that as3 dev team just forgot what a blank keyframe is.

I'm interested in the topic of "removeMovieClip" in as3, because it's a convenient use of the timeline, but I didn't take time to establish best practices about it.

However here are some tracks or tips:
- listen to REMOVED_FROM_STAGE at the top of display list. When an object is removed, "stop" it. - add complex behaviors to displayObjects (such as listeners, sounds, timers, etc..) using a "safe" API. That is: when you add something new (for example A) to displayObject B, you listen B's REMOVED_FROM_STAGE to "dispose" A.

I don't want to use a IDisposable interface everywhere. Probably I will use a more brutal approach with a function similar to http://blog.gludion.com/2008/11/script-code-test.html (sorry it's in french but the script is quite self-explanatory).

I anyone has other ideas, don't hesitate to share ;)


--
Olivier Besson (gludion) - (33 1) 44 64 78 99
http://www.gludion.com
http://blog.gludion.com

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to