frame - wait in seconds

  • Nem
  • Guru
  • Guru
  • No Avatar
  • Joined: Feb 13, 2004
  • Posts: 1243
  • Loc: UK
  • Status: Offline

Post September 6th, 2005, 9:39 am

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.
GSDomains.com -Click here - Packages starting from £3.69 a month. 1.5GB Space & 10GB Bandwidth.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post September 6th, 2005, 9:39 am

  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Joined: Jul 25, 2005
  • Posts: 2735
  • Loc: Nashville, TN
  • Status: Offline

Post September 6th, 2005, 11:29 am

//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.
I'd love to change the world, but they won't give me the source code.
  • Nem
  • Guru
  • Guru
  • No Avatar
  • Joined: Feb 13, 2004
  • Posts: 1243
  • Loc: UK
  • Status: Offline

Post September 6th, 2005, 11:48 am

Thanks, could you please also explain the code if you don't mind.
GSDomains.com -Click here - Packages starting from £3.69 a month. 1.5GB Space & 10GB Bandwidth.
  • shibbyy05
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Sep 07, 2005
  • Posts: 64
  • Loc: Ohio
  • Status: Offline

Post September 8th, 2005, 8:19 pm

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
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post September 9th, 2005, 8:03 am

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
  • No Avatar
  • Joined: Dec 21, 2006
  • Posts: 2
  • Status: Offline

Post December 21st, 2006, 12:40 pm

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
  • No Avatar
  • Joined: Feb 04, 2011
  • Posts: 1
  • Status: Offline

Post February 4th, 2011, 3:19 am

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 32 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.