Using the Keys in games...(TUT)

Yeah…this is something that bugged me for ages trying the whole

Key.isDown(Key.A)

So I learned how to use them and thought I’d help others out

Key.isDown(Key Code)

Is how you do it…but what are the codes? Well luckily theres a little bit of code thats fairly easily implemented to help you out there


var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
trace("The ASCII code for that key: "+Key.getAscii());
};
Key.addListener(keyListener);

Easy, huh?