![MACROMEDIA DIRECTOR MX 2004 Reference Download Page 821](http://html1.mh-extra.com/html/macromedia/director-mx-2004/director-mx-2004_reference_687516821.webp)
keyDownScript
821
125: BackUp
124: TurnRight
end case
end keyDown
// JavaScript syntax
function keyDown() {
switch (_key.keyCode) {
case 123: TurnLeft();
break;
case 126: GoForward();
break;
case 125: BackUp();
break;
case 124: TurnRight();
break;
}
}
See also
Key
,
key
keyDownScript
Usage
the keyDownScript
Description
System property; specifies the Lingo that is executed when a key is pressed. The Lingo is written
as a string, surrounded by quotation marks, and can be a simple statement or a calling script for
a handler.
When a key is pressed and the
keyDownScript
property is defined, Lingo executes the
instructions specified for the
keyDownScript
property first. Unless the instructions include the
pass
command so that the
keyDown
message can be passed on to other objects in the movie, no
other
on keyDown
handlers are executed.
Setting the
keyDownScript
property performs the same function as using the
when keyDown
then
command that appeared in earlier versions of Director.
When the instructions you specify for the
keyDownScript
property are no longer appropriate,
turn them off by using the statement
set the keyDownScript to EMPTY
.
Example
The following statement sets
keyDownScript to if the key = RETURN then go to the
frame + 1
. When this statement is in effect, the movie always goes to the next frame whenever
the user presses the Return key.
the keyDownScript = "if the key = RETURN then go to the frame + 1"
The following statement sets
keyDownScript
to the custom handler
myCustomHandler
. A Lingo
custom handler must be enclosed in quotation marks when used with the
keyDownScript
property.
the keyDownScript = "myCustomHandler"
Summary of Contents for DIRECTOR MX 2004
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...