
328
keyCode()
Syntax
the keyCode
Description
Function; gives the numerical code for the last key pressed. This keyboard code is the key’s
numerical value, not the American National Standards Institute (ANSI) value.
Note:
When a movie plays back as an applet, this function returns the values of only function and arrow keys.
You can use the
keyCode
function to detect when the user has pressed an arrow or function key,
which cannot be specified by the
key
function.
Use the sample movie Keyboard Lingo to test which characters correspond to different keys on
different keyboards.
This function can be tested but not set.
Examples
This handler uses the Message window to display the appropriate key code each time a key is pressed:
on enterFrame
the keydownScript = "put the keyCode"
end
This statement checks whether the up arrow (whose key code is 126) was pressed and if it was,
goes to the previous marker:
if the keyCode = 126 then go to marker(-1)
This handler checks whether one of the arrow keys was pressed and if one was, responds
accordingly:
on keyDown
case (the keyCode) of
123: TurnLeft
126: GoForward
125: BackUp
124: TurnRight
end case
end
See also
commandDown
,
controlDown
,
key()
,
optionDown
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...