Reversing Flash Timeline

Just recently, I have encountered a really simple problem that I have hard time figuring out the solution, but in hours of looking for that solution I just found one.

In the web, if we search for reversing a timeline in flash, we will find mostly solutions that are done using another movie clip, but It doesn’t solve my problem. I only need to reverse the timeline without creating another movie clip.

Here’s how I figure it out. The solution that worked for me, is to use the setInterval and the clearInterval.

To do so, create a simple animation/tween, then on the last frame, insert the following action script:

stop();
var speed:Number = 40;
function goto(destination) {
    if (_root._currentframe == destination)
       clearInterval(nIntervals);
    else
       prevFrame();
}
var nIntervals = setInterval(goto, speed,15);

In this, example I assumed you have more than 15 frames in your animation, let say you have 60-frame animation, From frame 60 the timeline will reverse play until frame 15.

Advertisements