Tween.nextFrame()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

tweenInstance.nextFrame()

Returns

Nothing.

Description

Method; forwards the tweened animation to the next frame of an animation that was stopped. Use this method to forward a frame at a time of a tweened animation after you use the Tween.stop() method to stop it.

NOTE

This method may be used only on frame-based tweens. A tween is set to frame based at its creation by setting the useSeconds parameter to false.

Example

This 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 a button called forwardByFrame_btn calls the Tween.stop() method to stop the animation, followed by calling the Tween.nextFrame() method. Clicking the button during the tweened animation has the effect of stopping the animation and then moving forward by only a single frame. When you create the Tween instance, the useSeconds parameter is declared false to make the tween frame based. This process is required to use the Tween.nextFrame() method. 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, 60, false);

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

forwardByFrame_btn.onRelease = function() {
     myTween.stop();
     myTween.nextFrame();
};