Tuesday, 22 July 2014

How to rewind an animation, AS3

To make the animation rewindable, it needs to be all on one timeline for starters. With no movieclips doing anything complicated that will look weird if everything is going backwards while they are going forwards. Flashing or jiggling, or something like that is fine, but it has to work backwards and forwards.

Graphic symbols are fine, because they will play backwards as the movie clip goes backwards.

Anyway...

In order to make the clip go backwards:

clip.addEventListener(Event.EnterFrame, goBack);

function goBack(evnt:Event):void {

clip.prevFrame();

}

In order to get the clip to stop going backwards, either once it gets to the beginning, or at certain points along the way, put code on the relevant frames inside the movie clip that checks if the eventListener exists, and if it does, removes it.

I hope that was clear enough.

No comments:

Post a Comment

Please enter your message here...