Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-15-2006, 05:40 AM   #1
LeeroyJenkins
Registered User
 
Join Date: Feb 2006
Posts: 6
Default Timer way off?

Has anyone else run into the Timer class firing way off schedule?

Like I have my Timer running at 50 msecs, but the output on the TimerEvent.TIMER call is sometimes firing at over twice the rate?

I recall flash 8's setInterval being at least a little better as far as the timing of the firing ...

there a workaround?


my 50msec timer output:
------------------------
7111
7214
7296
7358
7460
7542
7604
7706
7788
7850
7952
8055
8137
8198
8280
8342
8424
8485
8588
8670
8732
LeeroyJenkins is offline   Reply With Quote
Old 02-15-2006, 12:35 PM   #2
Tink
Addict
 
Tink's Avatar
 
Join Date: Nov 2001
Location: London
Posts: 2,128
Default

have you tested this in a movie with nothin else going on?

even though its a Timer i believe its still relies on frame rate and therefore can slow down as your movie slows down.
Tink is offline   Reply With Quote
Old 02-17-2006, 08:36 AM   #3
LeeroyJenkins
Registered User
 
Join Date: Feb 2006
Posts: 6
Default

it's literally a blank movie with nothing going on but the timer. frame rate set to 20. computer speed @ 3 ghz.
LeeroyJenkins is offline   Reply With Quote
Old 07-15-2006, 07:38 PM   #4
kwigbo
Registered User
 
Join Date: Jul 2006
Posts: 5
Default

I had the same problem when trying to create an animation using the timer. I didnt find a fix though.
kwigbo is offline   Reply With Quote
Old 07-16-2006, 01:41 AM   #5
Fall_X
Registered User
 
Join Date: Jul 2006
Posts: 85
Default

I may be wrong here, but the Timer object will never execute code at the exact time, but rather at the next frame from the exact time.
Even though you set your framerate to 20=1 frame per 50ms, Flash's framerate is never 100%. So if only 1 frame takes a bit more to execute, the Timer will be delayed by an entire frame.
It's just a guess, but it seems plausible to me.
Fall_X is offline   Reply With Quote
Old 07-16-2006, 03:26 AM   #6
cparcell
Registered User
 
Join Date: Jul 2006
Posts: 13
Default

Interesting, but I thought the whole idea behind the Timer was that it allowed seperation from frame based events. Just to see, have you tried pushing your frame rate up to say 300 or something silly?
cparcell is offline   Reply With Quote
Old 07-16-2006, 12:25 PM   #7
Fall_X
Registered User
 
Join Date: Jul 2006
Posts: 85
Default

Quote:
Originally Posted by cparcell
Interesting, but I thought the whole idea behind the Timer was that it allowed seperation from frame based events. Just to see, have you tried pushing your frame rate up to say 300 or something silly?
Maximum framerate is 120 if I'm not mistaking.
Fall_X is offline   Reply With Quote
Old 07-16-2006, 07:34 PM   #8
cparcell
Registered User
 
Join Date: Jul 2006
Posts: 13
Default

Quote:
Originally Posted by Fall_X
Maximum framerate is 120 if I'm not mistaking.
And that shows my Director history. Director can get wound up to 999 fps. although it is near impossible to actually get it to run at that rate.

Ok, so set it to 120 and see what happens.
cparcell is offline   Reply With Quote
Old 07-19-2006, 09:41 PM   #9
Kraken
Senior Member
 
Join Date: Apr 2001
Location: Kansas City
Posts: 671
Default

Is there still an updateAfterEvent in AS3? That would update your stage independently of the framerate. In previous versions of flash this was useful for fluid mouse events that weren't necessarily happening each frame.

Edit: After searching I found it:
http://livedocs.macromedia.com/labs/...ateAfterEvent()

I would say that's the way to make it happen, cap'n.
__________________
The coolest website ever!
Do you live in Kansas City? Come to KC Web Core and expand your skillset!

Last edited by Kraken; 07-19-2006 at 10:20 PM..
Kraken is offline   Reply With Quote
Old 03-29-2007, 08:19 PM   #10
4dplane
Registered User
 
Join Date: Mar 2007
Posts: 25
Default It is no better then setInterval - Crap!!!!

Hi all,

I am in need of a timer that works perfectly down to the hundredth of a second and I found this site and the link that was left by Kraken. I installed flash alpha 9 and ran the timer code and it does not work very well at all. It's hard to know by looking at trace outputs - but if you put a short sound in the timer and have it start every time the timer goes off, you can easily tell that it does not work very well at all.

Any other suggestion on how I might get a timer to work in flash so I can make a precise metronome / beat?

4dplane
4dplane is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
using timer prototype: not able to use inside another function sbhar ActionScript 2.0 0 11-11-2005 10:39 AM
reset timer blaatorx ActionScript 1.0 (and below) 0 05-19-2005 09:56 AM
Timer stops on frame... sporkles ActionScript 2.0 2 01-17-2005 06:12 PM
Timer Troubles jwaller50 ActionScript 1.0 (and below) 4 01-05-2005 10:18 PM
Timer (help needed) Queuer ActionScript 1.0 (and below) 4 12-08-2003 12:48 AM


All times are GMT. The time now is 12:26 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.