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:

  1. easeType = mx.transitions.easing.Strong.easeOut;
  2. myTween = new mx.transitions.Tween(myMovieClip_mc, "_x",easeType, 0, 600, 20);
  3.  
  4. // onMotionFinished is called when the tween is complete
  5. myTween.onMotionFinished = function() {
  6.         trace("myMovieClip_mc has finished moving.");
  7. };

A really good tutorial on mx.transitions is available over at ActionScript.org

Comments are closed.