ActionScript 2.0 Components Language Reference |
|
|
|
| Tween class > Tween.yoyo() | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
tweenInstance.yoyo()
Nothing.
Method; instructs the tweened animation to play in reverse from its last direction of tweened property increments. If this method is called before a Tween object's animation is complete, the animation abruptly jumps to the end of its play and then plays in a reverse direction from that point. You can achieve an effect of an animation completing its entire play and then reversing its entire play by calling the Tween.yoyo() method within a Tween.onMotionFinished event handler. This process ensures that the reverse effect of the Tween.yoyo method does not begin until the current tweened animation is complete. See Tween.onMotionFinished.
In the following example, a handler is triggered by the Tween.onMotionFinished event and tells the Tween instance to animate the img1_mc movie clip in a reverse direction by calling the Tween.yoyo() method. The result is a movie clip that moves from the left of the Stage to the right and then reverses direction, moving from right to left in an animation loop. 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.yoyo();
};
|
|
|
|