The following piece of script allows the tracing of keys. Here we are tracing when the spacebar is pressed.

var a:String = "SPACE";
_root.onEnterFrame = function() {
	if (Key.getCode() == Key[a]) {
	       delete this.onEnterFrame;
	       trace("YES");
	}
};