25-06-2008

Actionscript2 Simple tween example with callback

The callback is in the onMotionFinished handler function. MC is the movieclip the tween will be applied to.

import mx.transitions.Tween;
import mx.transitions.easing.*;
var tween1:Tween = new Tween(MC, "_rotation", Elastic.easeOut, 0, 360, 3, true);
 
tween1.onMotionFinished  = function()  {
  trace(this.obj._name); //this.obj refers to the movieclip the tween has been applied to
  this.yoyo(); //the 'this' keyword refers to the tween object itself
 
};

Transition description



Back
- Extends the animation beyond the transition range at one or both ends once to resemble an overflow effect.

Bounce
- Adds a bouncing effect within the transition range at one or both ends. The number of bounces relates to the duration--longer durations produce more bounces.

Elastic
- Adds an elastic effect that falls outside the transition range at one or both ends. The amount of elasticity is unaffected by the duration.

Regular
- Adds slower movement at one or both ends. This feature lets you add a speeding up effect, a slowing down effect, or both.

Strong
- Adds slower movement at one or both ends. This effect is similar to Regular easing, but it's more pronounced.

None
- Adds an equal movement from start to end without effects, slowing down, or speeding up. This transition is also called a linear transition.


These six easing classes each have three easing methods, which are described in the following table:
Method description



- easeIn Provides the easing effect at the beginning of the transition.

- easeOut Provides the easing effect at the end of the transition.

- easeInOut Provides the easing effect at the beginning and end of the transition.

Comments:

Your comment:

»

 

[x]