Tween.onMotionChanged

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

tweenInstance.onMotionChanged = function() {
    // ...
};

Description

Event handler; invoked with each change in the tweened object property that is being animated. Handling this event allows your code to react as the target movie clip's property that is being tweened increments to the next value.

Example

In this example, a tween is applied to the img1_mc movie clip. With each increment of the tween to the _x property of the movie clip, the onMotionChanged event handler is invoked and displays a trace message indicating the tweened movie clip's new position. A movie clip instance named img1_mc is required on the Stage for this example:

import mx.transitions.Tween;
var myTween:Tween = new Tween(img1_mc, "_x", mx.transitions.easing.Elastic.easeOut,0, Stage.width-img1_mc._width, 3, true);

myTween.onMotionChanged = function() {
    trace( this.position );
};