Key.getCode()
Top  Previous  Next


SWiSH Player Support
SWF5 or later

Syntax
Key.getCode()

Arguments
none

Returns
The keyboard code of the last pressed key.

Description
Method: Returns the keyboard code of the last pressed key.
This allows comparison / checking of keys that do not have an assigned ascii value via the other Key properties.
eg. Key.CAPSLOCK


Sample
onEnterFrame() {
   // _root.ret.text is a dynamic text element. 
   // this displays the ascii code of the last pressed key.
   _root.ret.text = Key.getCode();
   if (Key.GetCode() == Key.CAPSLOCK) {
      // the caps lock key is pressed
   }
}

See Also
Key.getAscii(), Key.getCode()