View Full Version : Timer way off?
LeeroyJenkins
02-15-2006, 05:40 AM
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
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.
LeeroyJenkins
02-17-2006, 08:36 AM
it's literally a blank movie with nothing going on but the timer. frame rate set to 20. computer speed @ 3 ghz.
kwigbo
07-15-2006, 07:38 PM
I had the same problem when trying to create an animation using the timer. I didnt find a fix though.
Fall_X
07-16-2006, 01:41 AM
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.
cparcell
07-16-2006, 03:26 AM
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?
Fall_X
07-16-2006, 12:25 PM
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.
cparcell
07-16-2006, 07:34 PM
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.
Kraken
07-19-2006, 09:41 PM
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/as3preview/langref/flash/events/TimerEvent.html#updateAfterEvent()
I would say that's the way to make it happen, cap'n.
4dplane
03-29-2007, 08:19 PM
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
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.