Tween.rewind()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

tweenInstance.rewind()

Parameters

None.

Returns

Nothing.

Description

Method; moves the play of a tweened animation back to its starting value. If Tween.rewind() is called while the tweened animation is still playing, the animation rewinds to its starting value and continues playing. If Tween.rewind() is called while the tweened animation has been stopped or has finished its animation, the tweened animation rewinds to its starting value and remains stopped. Use this method to rewind a tweened animation to its starting point after you have stopped it by using the Tween.stop() method or to rewind a tweened animation during its play.

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 a handler triggered by the Tween.onMotionFinished event. Clicking the rewindTween_btn button calls the Tween.rewind() method to rewind the tweened animation to its starting point. A movie clip instance named img1_mc, a movie clip instance named stopTween_btn, a movie clip instance named rewindTween_btn and a movie clip instance named resumeTween_btn, are required on the Stage for this example:

import mx.transitions.Tween;
var myTween:Tween = new Tween(img1_mc, "_x", mx.transitions.easing.None.easeNone, img1_mc._width, Stage.width, 8, true);

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

stopTween_btn.onRelease = function() {
    myTween.stop();
}; 

rewindTween_btn.onRelease = function() {
    myTween.rewind();
}; 

resumeTween_btn.onRelease = function() {
    myTween.resume();
};