Posted By

adrianparr on 10/27/11


Tagged

key right keyboard press cursor Left as3 keyboardevent keydown


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

PawelGIX


AS3 Left and Right Cursor Key Presses


 / Published in: ActionScript 3
 

  1. import flash.ui.Keyboard;
  2. import flash.events.KeyboardEvent;
  3.  
  4. stage.addEventListener(KeyboardEvent.KEY_DOWN, onStage_KEY_DOWN);
  5.  
  6. private function onStage_KEY_DOWN(event:KeyboardEvent):void
  7. {
  8. switch (event.keyCode)
  9. {
  10. case Keyboard.LEFT:
  11. trace("LEFT");
  12. break;
  13. case Keyboard.RIGHT:
  14. trace("RIGHT");
  15. break;
  16. }
  17. }

Report this snippet  

You need to login to post a comment.