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 continueTo Method

The continueTo Method instruct the tweened animation to continue tweening from its current animation point to a new finish and duration point.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

In this Flash SctionScript tutorial, we use continueTo Method to do a simple Loop Animation.

The finished Flash Movie of this tutorial is shown as above. The first motion is used with Tween Class. While all other motions are used with continueTo Methods.

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 = 300;
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 = "tweenX motion is FINISHED." + "\n" + "The function moveMore is called." + "\n" + "The football is now moving to y-80";

//Instructs tweenY animation to continue tweening
//from its current animation point to y-80 in 3 seconds
tweenY.continueTo(80, 5);

//Remove Listener if no longer in use
//tweenX.removeEventListener(TweenEvent.MOTION_FINISH, moveMore);

}

 

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

 

function moveAgain(event:TweenEvent):void {

//Display message in Msg Box
output_txt.text = "Both tweenX motion and tweenY are executed." + "\n" + "Either moveMore and moveAgain function is called." + "\n" + "Thus create a loop animation.";

//Instructs tweenX animation to continue tweening
//from its current animation point to x-50 in 3 seconds
tweenX.continueTo(50, 3);

//Instructs tweenY animation to continue tweening
//from its current animation point to y-200 in 3 seconds
tweenY.continueTo(200, 3);

//Remove Listener if no longer in use
//tweenY.removeEventListener(TweenEvent.MOTION_FINISH, moveAgain);

}

Download Flash Source File:

Flash Source File continueto-method-3.fla

Remarks:

This Flash ActionScript tutorial showed how to do animation with Tween Class with continueTo method. Actually you can explore more interesting animation with Tween Class and continueTo Methods.