// Import the flash events. We need to use the KeyboardEvent event. import flash.events.*; // Declare the event stage.addEventListener(KeyboardEvent.KEY_DOWN, key_down); // The handler for the KEY_DOWN event. function key_down(e:KeyboardEvent):void { // do stuff. // example of doing stuff. if(e.keyCode == 32) { // if the user presses space, do stuff. // you can see a full list of key codes here: // http://people.uncw.edu/tompkinsj/112/FlashActionScript/keyCodes.htm } }
Key Down Event in 3.0
Page 1 of 10 Replies - 959 Views - Last Post: 16 June 2008 - 01:59 AM
#1
Key Down Event in 3.0
Posted 16 June 2008 - 01:59 AM
Description:
1) Copy and paste the snippet into the actions pane of a frame.
2) Read the comments.Demonstrates asynchronous handling of key presses in ActionScript 3.0.
NOTE: This method does not handle multiple key presses. ActionScript 3.0 sucks for this ;).
Page 1 of 1