homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

best way to pause in actionscript
more flash issues

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

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)

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.



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

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



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

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved