Pausing the timeline in Flash

Posted: February 24th, 2009 | Author: Henrie Media Inc. | Filed under: Code Library, Flash | No Comments »

FlashI had a need to pause the timeline in a Flash project I was working on and found this script. I thought I would post it for others if they need to accomplish the same thing. Enjoy!

stop();

var nInterval = setInterval(Play, 5000);

function Play() {
clearInterval(nInterval);
gotoAndPlay(_currentframe+1);
}

so what does Every line mean …

stop();
//stop at your desired frame .

//Build the interval
// 1 second = 1000 milliseconds 1 x 1000
// setinterval(the-function , time[in milliseconds])

var nInterval = setInterval(Play, 5000);

/*function which will excute and clear the interval & Will play the next
Frame after 5 sec.*/

function Play() {
clearInterval(nInterval);
gotoAndPlay(_currentframe+1);

Print, Email, Share, Enjoy!
  • Print
  • email
  • Twitter
  • Facebook
  • Digg
  • MySpace
  • Mixx
  • del.icio.us
  • Technorati
  • StumbleUpon

Leave a Reply