What is the best way to make a game timer in Actionscript 3?

Posted by Nuthman on Stack Overflow See other posts from Stack Overflow or by Nuthman
Published on 2010-05-27T06:55:42Z Indexed on 2010/05/27 7:01 UTC
Read the original article Hit count: 145

I have built an online game system that depends on a timer that records how long it took a player to complete a challenge. It needs to be accurate to the millisecond. Their time is stored in a SQL database.

The problem is that when I use the Timer class, some players are ending up getting scores in the database of less than a second. (which is impossible, as most challenges would take at least 11 seconds to complete even in a perfect situation.)

What I have found is that if a player has too many browser windows open, and/or a slow computer, the flash game slows down actually affecting the timer speed itself. The timer is 'spinning' on screen so you can physically see the numbers slowing down.

It is frustrating that I cannot just open a second thread or do something to allow flash to keep accurate time regardless of whatever else is going on in the program. Any ideas?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about actionscript