User Guide
210 Chapter 11: Keywords
Example
This statement checks whether the carriage return was pressed and then continues if it was:
if the key = RETURN then go the frame + 1
This handler checks whether the Command and Q keys were pressed simultaneously and, if so,
executes the subsequent statements:
on keyDown
if (_key.commandDown) and (_key.key = "q") then
cleanUp
quit
end if
end keyDown
Compare the following two constructions and the performance results. The first construction
evaluates both conditions, and so must determine the time measurement, which may take a while.
The second construction evaluates the first condition; the second condition is checked only if the
first condition is
TRUE.
spriteUnderCursor = rollOver()
if (spriteUnderCursor > 25) and MeasureTimeSinceIStarted() then
_player.alert("You found the hidden treasure!")
end if
The alternate, and faster, construction would be as follows:
spriteUnderCursor = rollOver()
if (spriteUnderCursor > 25) then
if MeasureTimeSinceIStarted() then
_player.alert("You found the hidden treasure!")
end if
end if
See also
case
INF
Usage
-- Lingo syntax
INF
Description
Return value; indicates that a specified Lingo expression evaluates as an infinite number.
See also
NAN
item...of
Usage
-- Lingo syntax
textMemberExpression.item[whichItem]
item whichItem of fieldOrStringVariable
textMemberExpression.item[firstItem..lastItem]
item firstItem to lastItem of fieldOrStringVariable