Welcome to WebmasterWorld Guest from 23.20.186.146

Forum Moderators: open

Message Too Old, No Replies

best way to pause in actionscript

more flash issues

     
7:27 pm on Mar 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



how to have a script pause for say, 5 seconds then resume?

i tried something a long the lines of creating a function that uses onEnterFrame to increment a variable by one, and passing that function a number equal to the number of seconds i wanted to pause for mulitplied by the frame rate.

this worked but slowed playback down. (there was a few other onEnterFrames going on also)

any ideas> appreciated

8:00 pm on Mar 25, 2004 (gmt 0)

10+ Year Member



Hiya, Ben.

I don't have a lot of time to get too involved right now, but if you look in the help files for getTimer(), setInterval(), and clearInterval() they are exactly what you need.

The getTimer() method is more accurate, however the set and clear Interval methods were new beginning with Flash MX.
I said getTimer() is more accurate as the Interval methods are relative to the stage's fps where getTimer is real time.

I have used both many times and I'll help out if you have any questions when I'm more available.

Cheers,
winstun

8:28 pm on Mar 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks winstun

i did try playing with getTimer and storing it as a var then getting the timer again onEnterFrame and comparing the two, but it didnt quite come off.

setInterval sounds interesting....

thanks

8:38 pm on Mar 25, 2004 (gmt 0)

10+ Year Member



I've had a lot fun with setInterval in the past. Just keep in mind it isn't entirely accurate as I mentioned, but if a few milliseconds aren't an issue it's definately the way to go.

If used properly you don't even have to use onEnterFrame().

You can pm me for a tutorial on it.

Best of luck.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month