Play timeline backward

March 13th, 2007 by Slav

There are times where you would like for an animation on a timeline to be played backwards. This class does just that.

It strength is in it’s simplicity. To use it, simply pass the reference of a movie clip instance to it and from that moment on it will play the movie clip timeline backward.

this is code used in the example above

import com.durej.utils.PlayTimelineBackward;
import mx.utils.Delegate;
function playAnimationBackwards()
{
var backwardAni = new PlayTimelineBackward(ani_mc); 
}

function playForward()
{
 ani_mc.play();
}

play_btn.onRelease = Delegate.create(this,playForward);
playBack_btn.onRelease =Delegate.create(this,playAnimationBackwards);

Download for Flash CS3

Download for Flash 8

Posted in AS2, flash

7 Responses

  1. Bob

    How can I stop the animation during the reverse on a specific frame? A simple Stop didn’t seem to work.

  2. David

    Did anyone figure out how to stop the animation during reverse?

  3. Slav

    David:
    make backwardAni variable with a class scope
    add following to the script :

    public function stop():Void
    {
    delete timeline.onEnterFrame;
    }

    and then call backwardAni.stop();
    that should stop the animation…

  4. Dudeman

    Can you elaborate please?

  5. Misteremg

    im trying to use your code but it says in my compiler error

    Scene=Scene 1, layer=Layer 4, frame=1, Line 6

    The class or interface ‘com.durej.utils.PlayTimelineBackward’ could not be loaded.

  6. Misteremg

    this is the file i downloaded from here by the way when i run it its broken :S

  7. Slav

    Misteremg: My guess is you aren’t placing the class correctly in your classpath.

    Make sure
    1. it’s in the correct directory structure that reflects it’s package name.

    2. Your classpath definition in your IDE is correctly set up as well.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.