
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
t
extMemberExpression
.item[
whichItem]
item
whichItem
of
fieldOrStringVariable
textMemberExpression
.item[
firstItem..lastItem]
item
firstItem
to
lastItem
of
fieldOrStringVariable
Содержание DIRECTOR MX 2004-DIRECTOR SCRIPTING
Страница 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Страница 48: ...48 Chapter 2 Director Scripting Essentials...
Страница 100: ...100 Chapter 4 Debugging Scripts in Director...
Страница 118: ...118 Chapter 5 Director Core Objects...
Страница 594: ...594 Chapter 12 Methods...
Страница 684: ...684 Chapter 14 Properties See also DVD...
Страница 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Страница 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Страница 889: ...netPresent 889 _player alert Sorry the Network Support Xtras could not be found See also Player...
Страница 1102: ...1102 Chapter 14 Properties...