Archive for February, 2009
When AS3 came out many people, myself including, were frustrated and confused by the lack of a quick and dirty function to check whether a key was down (pressed). You can have a listener that gets fired when a key is pressed and see which key it was within that function. This could lead to someone putting all their key behaviour code in one spot which could become quite messy.
The best way to fix this is with a class that does all the heavy lifting for you. Without any any further ado here’s the test. Use the arrow keys, space, z and shift+z to try it out [source]: