View Full Version : How to check whether game is idle
jyothi_hk
January 23rd, 2007, 07:09 AM
hi,
I want to know how to check whether a game is idle for last few minutes/seconds.
means, for last 2 minutes no key is pressed then my flash movie goes to idle mode, by pressing a key it should resume back.
Regards,
Jyothi
pixelbath
January 23rd, 2007, 11:24 AM
Keep a running count of time (number of seconds, milliseconds, whatever) that is reset to zero each time a key is pressed. Once your count is higher than your threshold (2 minutes), then enter idle mode. Pressing a key at any time (idle or not) will reset your counter to zero.
You could also check against something like system time (something like lastTimeKeyPressed), but it would just be a roundabout way of doing what I suggested above.
nakor
January 24th, 2007, 01:03 AM
This is perfect for what you are after:
http://www.actionscript.org/forums/showpost.php3?p=460852&postcount=78
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.