setTimeOut to delay functions


/ Published in: ActionScript
Save to your folder(s)

If you do not want to convert it to seconds and prefer to use milliseconds then you can use the following:
stop();
function wait() {
play(); // Just continue playing
// gotoandplay(50); // Play a specific frame or frame label
// someFunction(); // Call a function
// etc...
}
setTimeout(wait, 4500); // milliseconds


Copy this code and paste it in your HTML
  1. // setTimeOut Example
  2. stop();
  3. var timelineDelay:Number = 5; // Pause the TimeLine (in seconds)
  4. function wait() {
  5. play(); // Just continue playing
  6. // gotoandplay(50); // Play a specific frame or frame label
  7. // someFunction(); // Call a function
  8. // etc...
  9. trace("Timeline was delayed "+timelineDelay+" seconds, now continuing");
  10. }
  11. setTimeout(wait, timelineDelay*1000); // converts from milliseconds to seconds
  12. // (1000 milliseconds = 1 second)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.