A better wat of capturing keystrokes


I’m a bit of a flash noob, and I’m having a few issues with keypresses being over-captured. In this case if the movie runs slowly for any reason, keypresses are being queued up and then executed for quite some time after the key was released. This introduces a really nasty laggy feeling. You can try it here:


It’s a zipped projector file. You need to have an athlon 2600 or less, or just run another SWF in the background to see the effect.

This is how I currently capture keypresses:

if (Key.isDown(Key.RIGHT)) {
	if (_root.world_rotate_velocity > (_root.max_rotate_velocity * -1)) {
		_root.world_rotate_velocity -= _root.rotate_acceleration;

Does anyone have a better technique for capturing keypresses?