Actionscript:
- 
// create constants for all letter and number keys:
 - 
var alphabet:Array = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
 - 
var nums:Array = ["ZERO","ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE"];
 - 
 - 
var key:Object = new Object();
 - 
for (var i:int = 0; i<alphabet.length; i++)
 - 
key[alphabet[i]] = 65 + i;
 - 
 - 
for (i = 0; i<nums.length; i++){
 - 
var code:int = 48 + i;
 - 
key[nums[i]]= code;
 - 
key[i] = code;
 - 
}
 - 
 - 
 - 
// test them out
 - 
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
 - 
function onKeyPressed(evt:KeyboardEvent):void {
 - 
if (evt.keyCode == key.A){
 - 
trace("the a was pressed");
 - 
}
 - 
if (evt.keyCode == key.B){
 - 
trace("the b was pressed");
 - 
}
 - 
if (evt.keyCode == key.NINE){
 - 
trace("the 9 key was pressed");
 - 
}
 - 
if (evt.keyCode == key["0"]){
 - 
trace("the 0 key was pressed");
 - 
}
 - 
}
 
This is an easy way to store values for alphanumeric keys in variables that make sense... instead of having to do things like this:
Actionscript:
									- 
// hit the zero key
 - 
if (evt.keyCode == 48){
 - 
trace("the zero key was hit");
 - 
}