Wednesday, 8 April 2009

Banners with one frame, Recursive Call with TweenLite

So, this is an example of how to make a banner in Actionscript 3.0 with no timeline animation.
You can see it here. You can download the .fla here.

The code:

import gs.TweenLite;

function infiniteMovement()
{
cuad_mc.x=0;
TweenLite.to(cuad_mc, 5, {x:250, onComplete:onFinishTween, onCompleteParams:[4,tracker_mc]});
}

function onFinishTween(parameter1:Number,parameter2:MovieClip)
{
infiniteMovement();
}

infiniteMovement();

stop();

tracker_mc is just a movieclip out of the stage. This way, after five seconds of animation I use this movieclip as a reference just to call again to the function infiniteMovement()

More about tweenlite in GreenSock
Post a Comment