frame - wait in seconds

  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

Hello,

How can i on the timeline tell flash to stop for a number of seconds on a frame, and then carry on to the other frames after the set number of seconds?

Thanks

Nem.
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

//EDIT: found a better way!

function paused(sec) {
stop(); // action to pause
var i = sec - 1;
var t = setInterval(function () {
if (i == 0) {
clearInterval(t);
play(); // action to continue
}
i--;
}, 1000);
}

Place this function in the first frame of your movie, & then call the function paused(#) where # is the number of seconds you want the pause to last from within whatever frame you want the pause to occur.
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

Thanks, could you please also explain the code if you don't mind.
  • shibbyy05
  • Beginner
  • Beginner
  • shibbyy05
  • Posts: 64
  • Loc: Ohio

Post 3+ Months Ago

here is also another good solution...

Code: [ Select ]
function wait() {
    stop();
    var myInterval = setInterval(function () {
        play();
        clearInterval(myInterval);
    }, 5*1000); // stop for 5 seconds
}
wait();
  1. function wait() {
  2.     stop();
  3.     var myInterval = setInterval(function () {
  4.         play();
  5.         clearInterval(myInterval);
  6.     }, 5*1000); // stop for 5 seconds
  7. }
  8. wait();
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

Those are both essentially the same code just written a bit differently.

In a sense what happens is that your telling flash to loop for a set period of time in this case milliseconds. Then the clear interval breaks flash out of the loop.

Here's a more detailed explanation.

http://www.actionscript.org/tutorials/intermediate/setInterval/index.shtml
  • pioSko
  • Born
  • Born
  • pioSko
  • Posts: 2

Post 3+ Months Ago

UPSGuy wrote:
//EDIT: found a better way!

function paused(sec) {
stop(); // action to pause
var i = sec - 1;
var t = setInterval(function () {
if (i == 0) {
clearInterval(t);
play(); // action to continue
}
i--;
}, 1000);
}

Place this function in the first frame of your movie, & then call the function paused(#) where # is the number of seconds you want the pause to last from within whatever frame you want the pause to occur.


Found here: http://www.dreamincode.net/code/snippet127.htm

Hi :) New here... hope I can help out every now and then.
  • Sharpnsexyoak
  • Born
  • Born
  • Sharpnsexyoak
  • Posts: 1

Post 3+ Months Ago

Try this to delay a flash animation on a frame in AS3...

Paste the following into your 1st frame in your actions layer:

function playit(e:TimerEvent):void {
play();
}

var Tim:Timer = new Timer(100, 1);
Tim.addEventListener(TimerEvent.TIMER, playit);

There after insert the following on any frame where you would like to delay the animation:

stop();
Tim.delay = 1000; //Adjust Accordingly - 1000 Equals 1 Second
Tim.start();

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 5 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.