Flash AS3 Tutorials Center | Interesting Flash Animation Tutorials | Valuing Flash Animation Tutorials | Flash ActionScript and Animation Home

AS3 Beginner Tutorials | AS3 Basic Lessons | AS3 Valuing Courses | AS3 Components Tutorials | AS3 and PHP Interaction Tutorials
AS3 Practical Tutorials | AS3 Animation Techniques | AS3 Transition Effects Tutorials | AS3 Download Upload Files | AS3 Particle Systems
Communication Between Flash Movies with AS3 | AS3 and JavaScript interaction | AS3 Matrix Transformation | AS3 Physics Simulation Tutorials

Flash ActionScript Tutorial: Loop Animation with Tween Class and Multiple yoyo Methods

The yoyo Method will instruct the tweened animation to play in reverse from its last direction of tweened objects.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

Actually you can use multiple yoyo Methods with the tweened objects. This flash actionscript animation tutorial will use two yoyo Methods with the tweened football.

The finished Flash Movie of this tutorial is shown as above. By adding two yoyo Methods to the tweened football, it can created a more interesting loop animation.

Flash ActionScript Codes:

//import transition classes
import fl.transitions.*;
import fl.transitions.easing.*;

//Destination location the specified movie clips will move to
var x2:Number = 420;
var y2:Number = 200;

//Tween animation in x-axis
var tweenX:Tween = new Tween(football_mc, "x", Regular.easeOut, football_mc.x, x2, 3, true);

//Tween animation in y-axis
var tweenY:Tween = new Tween(football_mc, "y", Regular.easeOut, football_mc.y, y2, 3, true);

//Add Listener to tweenX
//Listen when the motion of tweenX FINISHED
//Will call moveMore function when motion of tweenX FINISHED
tweenX.addEventListener(TweenEvent.MOTION_FINISH, moveMore);

 

function moveMore(event:TweenEvent):void {

//Display message in Msg Box
output_txt.text = "When tweenX motion is FINISHED." + "\n" +

"The motion will be played in reverse." + "\n" +
"The function moveMore will be called whenever a motion is finished.";

 

//Instructs tweenX animation to play in reverse
//from its last direction
tweenX.yoyo();

 

//Instructs tweenY animation to play in reverse
//from its last direction
tweenY.yoyo();

}

Download Flash Source File:

Flash Source File yoyo-method-2.fla

Remarks:

This Flash ActionScript tutorial used two yoyo Methods with the tweened object..