Key in Anark Studio 2.5
Holds information about key presses.
Inherits from:
Instance Properties
| name | type | description |
|---|---|---|
| constructor | Object | A reference to the constructor class for the current object instance. [from Object] |
| prototype | Object | The prototype for a class. [from Object] |
Instance Methods
| name | returns | description |
|---|---|---|
| hasOwnProperty(propertyOrMethodName) | Boolean | Determines if the object/instance itself has the named property or method. [from Object] |
| isPrototypeOf(instanceToTest) | Boolean | Determines if the calling object prototype is in the inheritance chain for the supplied argument. [from Object] |
| propertyIsEnumerable(propertyOrMethodName) | Boolean |
Determines if the object/instance itself has a property or method of the supplied name which will appear in a for (prop in obj) enumeration.
[from Object]
|
| toLocaleString() | String |
For most objects, the same as toString() unless explicitly overridden.
[from Object]
|
| toString() | String | Returns a string representation of the object. [from Object] |
| valueOf() | String |
Returns the internal this value of the object.
[from Object]
|
Description
The key object is available at any time to obtain information about what keys, if any, are being pressed. Because it is a global object, it can be accessed directly.
The key object has named properties for every key which may be pressed; each of these properties is a simple object with code and pressed properties. The code property returns the numeric keyCode value for that key, and the pressed property returns a boolean value indicating whether or not the key is being pressed.
A listing of all named properties follows the example.
Key Examples
\\Pass the code for the Up Arrow key to an Event object.
function onKeyDown (inEvent)
{
if ( inEvent.keyCode == key.up.code){
\\Make the parent object rotate 10
this.parent.rotation.x += 10;
}
}
Key properties
| Property | Keyboard Name |
|---|---|
| zero | 0 |
| one | 1 |
| two | 2 |
| … | … |
| eight | 8 |
| nine | 9 |
| A | A |
| B | B |
| … | … |
| Y | Y |
| Z | Z |
| back | BACKSPACE |
| tab | TAB |
| clear | CLEAR |
| return | ENTER |
| shift | SHIFT |
| lshift | LEFT SHIFT KEY |
| rshift | RIGHT SHIFT KEY |
| control | CTRL |
| lcontrol | LEFT CONTROL KEY |
| rcontrol | RIGHT CONTROL KEY |
| pause | PAUSE |
| capital | CAPS LOCK |
| escape | ESC |
| space | SPACE BAR |
| prior | PAGE UP |
| next | PAGE DOWN |
| home | HOME |
| end | END |
| up | UP ARROW |
| down | DOWN ARROW |
| left | LEFT ARROW |
| right | RIGHT ARROW |
| select | SELECT |
| snapshot | PRINT SCREEN |
| insert | INS |
| delete | DEL |
| help | HELP |
| numLock | NUM LOCK |
| scroll | SCROLL LOCK |
| numpad0 | Numeric Keypad 0 |
| numpad1 | Numeric Keypad 1 |
| … | … |
| numpad8 | Numeric Keypad 8 |
| numpad9 | Numeric Keypad 9 |
| multiply | * |
| add | + |
| subtract | - |
| decimal | . |
| divide | / |
| equals | = |
| minus | - |
| separator | SEPARATOR |
| semicolon | ; |
| period | . |
| comma | , |
| forwardSlash | / |
| backwardslash | \ |
| tilde | ~ |
| quote | " |
| openbracket | [ |
| closebracket | ] |
| F1 | F1 |
| F2 | F2 |
| … | … |
| F23 | F23 |
| F24 | F24 |