Tween.onMotionStarted

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

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

Description

Event handler; invoked when the animation starts again during or after completing its animation. This event handler is not invoked at the initial start of a tweened animation. Calling the Tween.start(), Tween.yoyo() or Tween.yoyo()method to restart a finished animation or restart during an animation invokes the onMotionStarted event handler. Handling this event allows your code to react at the point at which the tweened animation was started again sometime after its initial start.

Example

The following example applies a tweened animation to the img1_mc movie clip. The animation is looped to play repeatedly from its starting point by calling the Tween.start() method from within the Tween.onMotionFinished event handler. When the Tween.start() method is called, the Tween instance invokes the Tween.onMotionStarted event handler. 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.None.easeNone,0, Stage.width, 4, true);

myTween.onMotionFinished = function() {
    myTween.start();
}; 

myTween.onMotionStarted = function() {
    trace("onMotionStarted");
};