Amit Dhamu

Writes Code

AS3 Keyboard Events

function onKeyPress(e:KeyboardEvent):void {
   switch (e.keyCode) {
      case Keyboard.ENTER:
          msg_txt.text = "You pressed Enter";
         break;
        case Keyboard.BACKSPACE:
          msg_txt.text = "You pressed Backspace";
         break;
        case Keyboard.DELETE:
         msg_txt.text = "You pressed Delete";
            break;
        case Keyboard.PAGE_DOWN:
          msg_txt.text = "You pressed Page Down";
         break;
        case Keyboard.PAGE_UP:
            msg_txt.text = "You pressed Page Up";
           break;
        case Keyboard.END:
            msg_txt.text = "You pressed End";
           break;
        case Keyboard.HOME:
           msg_txt.text = "You pressed Home";
          break;
        case Keyboard.CONTROL:
            msg_txt.text = "You pressed Control";
           break;
        case Keyboard.INSERT:
         msg_txt.text = "You pressed Insert";
            break;
        case Keyboard.SPACE:
          msg_txt.text = "You pressed Space";
         break;
        default:
          msg_txt.text = "Keycode: "+e.keyCode;
   }
}

addEventListener(KeyboardEvent.KEY_UP, onKeyPress);


keyboard events / keycodes / as3 / actionscript 3

← Client Location From Google Clean URLs →