I started using Flash’s native tween class a lot more the last few months and I was curious to see what changed in AS3 when it comes to simple scripted tweens. The answer is, not much. The biggest differences are the path to import the class and your event Listeners.
Here’s a quick rundown of the differences:
Importing AS2:
import mx.transitions.Tween;
import mx.transitions.easing.*;
Importing AS3:
import fl.transitions.Tween;
import fl.transitions.easing.*;
Listening for onMotionFinished in AS2:
molTween.onMotionFinished = function() {
output_txt.text += "tween done";
}
Listening for onMotionFinished ins AS3:
molTween.addEventListener("motionFinish", finishedTween);
function finishedTween(event:Event):void {
trace(“tween done”);
}
Check out the source files to see the full code in action.