March 4th, 2005
ActionScript — Use mx.transitions.Tween
Using the mx.transitions Class is very easy and a simple way to tween stuff that used to take a LOT longer to do the "old-way".
Syntax:
referenceID = new mx.transistions.Tween( InstanceName, "_property", easingType, beginning value, ending value, # of frames or seconds, boolean);
Example:
Actionscript:
-
easeType = mx.transitions.easing.Strong.easeOut;
-
myTween = new mx.transitions.Tween(myMovieClip_mc, "_x",easeType, 0, 600, 20);
-
-
// onMotionFinished is called when the tween is complete
-
myTween.onMotionFinished = function() {
-
trace("myMovieClip_mc has finished moving.");
-
};
A really good tutorial on mx.transitions is available over at ActionScript.org
