<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Here is some background on tween engines, and why I think Go strikes a really nice balance for AS3 in the area of memory management.<br><br>AS2:<br><br>One of the primary reasons this was such a big issue in AS2 was that so many designer/coders were still writing their code in timeline frames. Any variable declared in the root timeline is retained in memory like a variable at the top of a class. But besides that the AVM1's Garbage Collection simply did not work as well. Event listeners left subscribed would leave references to objects in memory (which you can avoid in AS3 using the useWeakReference flag).<br><br>AS2 tween engines – zigoengine, tweener, et al – were managers, to try &amp; help with these issues. What they do is generate tween objects, store them during play then delete them. This way the user doesn't need any references to an actual Tween object in their code and so cannot clutter memory as easily. Fuse2 does let you create reusable objects in your scripts, but it also manages its own instances to be able to provide an "autoClear" option – more evidence of trying hard to work with AS2.<br><br>The Flash Tween class (written by Robert Penner for Flash MX) is not a managed tween engine, it's just a single class that runs a single tween. For those tweens you always ended up with references in memory and if you weren't really careful they would hang out there permanently. So it may not have been "managed" by a utility but did leave that option up to the coder.<br><br><br>A3:<br>Object Oriented coding in AS3 has far better memory management and a better GC. Any object pointed to by a local var declared in a function (such as a tween) will get garbage collected once there are no more references to it elsewhere.<br><br>This presents a new problem for the Tween class though: Tweens that aren't stored in a permanent variable will suddenly stop in mid-play as the GC runs a sweep!!<br><br>The heavy centralized engines of AS2 are no longer needed, and Go is living proof of that. In Go, tween instances add &amp; remove themselves from a simple pulse engine which retains references to those items during play. As soon as an item removes itself it becomes eligible for GC, unless you've directly made a reference to it elsewhere. So it's a really nice balance where the end user gets to pick whether to store a reference to a tween or not, it works great either way.<br><br>The crazy thing too, is how easy it is to make a "tween engine" using Go. Just define a static method that generates and starts a tween – that's it. If you want a more full featured engine that can do things like pause individual tweens, this could be done very simply by writing a custom manager class that implements IManager and registers itself to the engine.<br><br>- m</body></html>