Static Functions
Checks whether the specified key is pressed.
Sample code:
function onMouseDown(event) { if(Key.isDown('shift')) { print('The shift key is currently pressed.') } }
- Parameters:
- key: String ('command', 'enter', 'return', 'backspace', 'tab', 'cancel', 'clear', 'shift', 'control', 'alt', 'option', 'pause', 'caps-lock', 'escape', 'space', 'page-up', 'page-down', 'end', 'home', 'left', 'up', 'right', 'down', 'comma', 'minus', 'period', 'slash', 'num-0', 'num-1', 'num-2', 'num-3', 'num-4', 'num-5', 'num-6', 'num-7', 'num-8', 'num-9', 'semicolon', 'equals', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'open-bracket', 'close-bracket', 'backslash', 'numpad-0', 'numpad-1', 'numpad-2', 'numpad-3', 'numpad-4', 'numpad-5', 'numpad-6', 'numpad-7', 'numpad-8', 'numpad-9', 'multiply', 'add', 'separator', 'subtract', 'decimal', 'divide', 'delete', 'num-lock', 'scroll-lock', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12', 'print-screen', 'insert', 'help', 'meta', 'back-quote', 'quote', 'kp-up', 'kp-down', 'kp-left', 'kp-right', 'dead-grave', 'dead-acute', 'dead-circumflex', 'dead-tilde', 'dead-macron', 'dead-breve', 'dead-above-dot', 'dead-diaeresis', 'dead-above-ring', 'dead-double-acute', 'dead-caron', 'dead-cedilla', 'dead-ogonek', 'dead-iota', 'dead-voiced-sound', 'dead-semivoiced-sound', 'ampersand', 'asterisk', 'quotedbl', 'less', 'greater', 'brace-left', 'brace-right', 'final', 'convert', 'non-convert', 'accept', 'mode-change', 'kana', 'kanji', 'alphanumeric', 'katakana', 'hiragana', 'full-width', 'half-width', 'roman-characters')
- Returns:
- Boolean — true if the key is pressed, false otherwise