repeat with...down to
221
repeat with
Usage
-- Lingo syntax
repeat with
counter
=
start
to
finish
statement(s)
end repeat
Description
Keyword; executes the Lingo specified by
statement(s)
the number of times specified by
counter
. The value of
counter
is the difference between the value specified by
start
and the
value specified by
finish
. The counter is incremented by 1 each time Lingo cycles through the
repeat loop.
The
repeat with
structure is useful for repeatedly applying the same effect to a series of sprites
or for calculating a series of numbers to some exponent.
While in a repeat loop, Lingo ignores other events. To check the current key in a repeat loop, use
the
keyPressed
property.
Only one handler can run at a time. If Lingo stays in a repeat loop for a long time, other events
stack up waiting to be evaluated. Therefore, repeat loops are best used for short, fast operations or
when users are idle.
If you need to process something for several seconds or more, evaluate the function in a loop with
some type of counter or test to track progress.
If the stop condition is never reached or there is no exit from the repeat loop, you can force
Director to stop by using Alt+period (Windows) or period (Macintosh).
Example
This handler turns sprites 1 through 30 into puppets:
on puppetize
repeat with channel = 1 to 30
_movie.puppetSprite(channel, TRUE)
end repeat
end puppetize
See also
exit
,
exit repeat
,
repeat while
,
repeat with...down to
,
repeat with...in list
repeat with...down to
Usage
-- Lingo syntax
repeat with
variable
=
startValue
down to
endValue
Description
Keyword; counts down by increments of 1 from
startValue
to
endValue
.
Only one handler can run at a time. If Lingo stays in a repeat loop for a long time, other events
stack up waiting to be evaluated. Therefore, repeat loops are best used for short, fast operations or
when you know the user won’t be doing other things.
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...