378
Chapter 12: Methods
Example
The following statement checks whether the user pressed the Enter key in Windows or the Return
key on a Macintosh and runs the handler
updateData
if the key was pressed:
-- Lingo syntax
if (_key.keyPressed(RETURN)) then
updateData
end if
// JavaScript syntax
if (_key.keyPressed(36)) {
updateData();
}
This statement uses the keyCode for the
a
key to test if it’s down and displays the result in the
Message window:
-- Lingo syntax
if (_key.keyPressed(0)) then
put("The key is down")
end if
// JavaScript syntax
if (_key.keyPressed(0)) {
put("The key is down");
}
This statement uses the ASCII strings to test if the
a
and
b
keys are down and displays the result
in the Message window:
-- Lingo syntax
if (_key.keyPressed("a") and _key.keyPressed("b")) then
put("Both keys are down")
end if
// JavaScript syntax
if (_key.keyPressed("a") && _key.keyPressed("b")) {
put("Both keys are down");
}
See also
Key
,
key
,
keyCode
label()
Usage
-- Lingo syntax
_movie.label(
stringMarkerName
)
// JavaScript syntax
_movie.label(
stringMarkerName
);
Description
Movie method; indicates the frame associated with a marker label.
The parameter
stringMarkerName
should be a label in the current movie; if it’s not, this method
returns 0.
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
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...