Return of the Key Class to Actionscript 3.0
This started out merely as a convenient class for handling keystrokes, and checking to see whether a particular key was being held down, mainly for arcade-type games.
As I started rewriting it for public release I wondered if I could emulate as closely as possible the functionality of the old AS1/AS2 Key Class I've spent the past seven years using. I had a play with some static methods and properties, and came up with this
You set it up like this:
import Key;
Key.listen(stage);
Now place it in your game loop and use it the same way you did before:
if (Key.isDown(Key.LEFT)){trace("Left cursor key is being pressed")}
Hit me up in the comments if you have any problems with it.
As I started rewriting it for public release I wondered if I could emulate as closely as possible the functionality of the old AS1/AS2 Key Class I've spent the past seven years using. I had a play with some static methods and properties, and came up with this
You set it up like this:
import Key;
Key.listen(stage);
Now place it in your game loop and use it the same way you did before:
if (Key.isDown(Key.LEFT)){trace("Left cursor key is being pressed")}
Hit me up in the comments if you have any problems with it.
Labels: actionscript, AS2, as3, input, Key, Keyboard, missing class
