Skip to main content
June 7, 2014
Answered

is it possible to make a timer with AS3 which is accurate upto one millisecond.

  • June 7, 2014
  • 2 replies
  • 955 views

I am new to AS3. I have somehow developed a auditory and visual reaction timer by taking script from here and there. I know its not accurate and I also know that I will write it correctly when I have learned the script thoroughly,

But I was checking the net about the timer class and various posts on it and  I am vexed with a question "if its possible to make an accurate timer with AS3?" can somebody please tell me for sure. and I will be grateful if I know how to make it correctly. I can post the code which I have written ( assembled ).

This topic has been closed for replies.
Correct answer kglad

the answer is, maybe. but for, for most coders, the answer is, no.

getTimer() is accurate to within 1 ms.  but that allows you to determine time/elapsed time and does not call or execute code on a regular timed schedule. it can be used with the timer class or enterframe events to do some things accurately.

however, the timer class is not accurate in the way beginning coders think.  it will, on average, allow calling a function at close to the designated interval if there are no performance issues with your swf.  it does not allow each function call to occur at a regular interval.

2 replies

Participating Frequently
June 9, 2014

You might want to take a look at this: http://jacksondunstan.com/articles/2348

kglad
Community Expert
Community Expert
June 9, 2014

that's for timing code execution, not the display.  in addition, unless your computer-state (not just your flash-state) is constant, that's useless, and i don't think anyone's computer-state is constant.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 7, 2014

the answer is, maybe. but for, for most coders, the answer is, no.

getTimer() is accurate to within 1 ms.  but that allows you to determine time/elapsed time and does not call or execute code on a regular timed schedule. it can be used with the timer class or enterframe events to do some things accurately.

however, the timer class is not accurate in the way beginning coders think.  it will, on average, allow calling a function at close to the designated interval if there are no performance issues with your swf.  it does not allow each function call to occur at a regular interval.

June 8, 2014

Thanks for the meaningful reply.

kglad
Community Expert
Community Expert
June 8, 2014

you're welcome.

p.s. please mark helpful/correct responses, if there are any.