User Guide

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.