/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import flash.ui.Keyboard; import flash.events.KeyboardEvent; stage.addEventListener(KeyboardEvent.KEY_DOWN, onStage_KEY_DOWN); private function onStage_KEY_DOWN(event:KeyboardEvent):void { switch (event.keyCode) { case Keyboard.LEFT: trace("LEFT"); break; case Keyboard.RIGHT: trace("RIGHT"); break; } }