import mx.core.Application ;
import flash.events.KeyboardEvent;
import mx.controls.Alert;
private function init():void
{
this.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler );
}
private function keyHandler (e:KeyboardEvent):void
{
txt_code.text = String(e.keyCode);
txt_char.text = String(e.charCode);
}