How to Pause A Flash Timeline without Adding Frames or Using a Clunky Timer

by carl schooff on September 14, 2010 · View Comments

in GreenSock Tweening Platform Tips

This one is a real hoot. A single compact line of code to pause your timeline for any amount of time. Quit jamming on F5 and adding a zillion frames. You are better than that.

Download Source Files

snorklTV-sample-pause-timeline: Flash CS3

Special Thanks

Commenter and loyal reader Matthew Lein posted a great comment about another way to do this as well.

var pauseAmount:Number = 3000; //milliseconds

setTimeout(play, pauseAmount)

Additional Resources

If you need to learn about getting the Greensock Tweening code visit: www.greensock.com

Also check out my 2 Part killer Intro to TweenMax

Got questions? I might have answers. Take a stab in the comments below!

Post to Twitter Post to Facebook

  • Ankit Chaurasia

    Hi,

    i use the code same in your video i.e.

    import com.greensock.*;
    var pauseAmount:Number = 1;
    TweenLite.delayedCall(5, play);
    stop();

    but when i go for test run i got 3 error in it i.e.

    1172: Definition com.greensock could not be found.
    1120: Access of undefined property TweenLite.

    so can i know what mistake i am doing.

    Thank you
    ankit@mayafan.in

  • http://www.snorkl.tv/ carl schooff

    Hi Ankit. It sounds like you are missing the tweenlite code. Did you download the tweening code from greensock.com?

    If you download the sample files and run my fla that is the best way to experiment with how it works.

    Let me know if you need more help.

    Carl

  • Matt

    This is a great tip, timelines are a drag and my poor F5 key needs a break.
    As an alternative, you can do it with setTimeout(functionToCall, msDelay), also in 1 line:

    var pauseAmount:Number = 3000;

    setTimeout(play, pauseAmount)

    or more manually…

    setTimeout( function() {
    //do some awesome
    }, 500)

  • http://matthewlein.com Matthew Lein

    I was hoping this would auto-recognize my email…

  • http://www.snorkl.tv/ carl schooff

    thank you for your contribution. I have added this solution to the post above.

blog comments powered by Disqus

Previous post:

Next post: