Start a new Flash ActionScript3 movie and copy the code in the action window.
stage.addEventListener(KeyboardEvent.KEY_DOWN, doKeyDown);
function doKeyDown(e:KeyboardEvent):void {
trace(e);
} //doKeyDown
With the movie running and keyboard shortcuts disabled, type a few keys.
You will notice some useful properties of e, the keyboard event:
e.ctrlKey is true if the control key is held;
e.altKey is true if the ALT key is held;
e.shiftKey is true if the shift key is held.
The other property of e is e.keyCode which we can look at to see which key was pressed.
You can try typing various keys in the movie below: