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

PropertyKeyboard Name
zero0
one1
two2
eight8
nine9
AA
BB
YY
ZZ
backBACKSPACE
tabTAB
clearCLEAR
returnENTER
shiftSHIFT
lshiftLEFT SHIFT KEY
rshiftRIGHT SHIFT KEY
controlCTRL
lcontrolLEFT CONTROL KEY
rcontrolRIGHT CONTROL KEY
pausePAUSE
capitalCAPS LOCK
escapeESC
spaceSPACE BAR
priorPAGE UP
nextPAGE DOWN
homeHOME
endEND
upUP ARROW
downDOWN ARROW
leftLEFT ARROW
rightRIGHT ARROW
selectSELECT
printPRINT
snapshotPRINT SCREEN
insertINS
deleteDEL
helpHELP
numLockNUM LOCK
scrollSCROLL LOCK
numpad0Numeric Keypad 0
numpad1Numeric Keypad 1
numpad8Numeric Keypad 8
numpad9Numeric Keypad 9
multiply*
add+
subtract-
decimal.
divide/
equals=
minus-
separatorSEPARATOR
semicolon;
period.
comma,
forwardSlash/
backwardslash\
tilde~
quote"
openbracket[
closebracket]
F1F1
F2F2
F23F23
F24F24