Actionscript 3.0 Tween Class Issue

Tween class in Actionscript 3.0 does not work the way it works in AS 2.0. In AS 2.0 we could create tween class variables inside a function and do a tween animation without worrying about garbage collection of the variable (declared using var) after the scope of the function is over.

However this was not the case in Actionscript 3.0. Though it works, sometimes or rather most of the times the animation tends to halt in between or does not complete. This is a serious trouble since any TweenEvent.MOTION_FINISHED even does not get handled if any.

The only solution to this problem was to define a Tween class member variable or a global static one. And if you try using the same static variable for more than one tween animation then you are still in soup. It is not guaranteed to work. In AS 3.0 you might have to overcome this using an array of variables of type Tween. This is the workaround to the problem.

But since we have the garbage collector doing a timely sweep and clean we need not worry about memory handling though we need to code effectively.

Comments

Popular posts from this blog

Authoritative Server - MMO

Code dependencies