User Guide

545
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.
The Director player for Java doesnt detect mouse movements, update properties that indicate the
mouses position, or update the status of mouse button presses when Lingo is in a repeat loop.
If the stop condition is never reached or there is no exit from the repeat loop, you can force
Director to stop by using Control+Alt+period (Windows) or Command+period (Macintosh).
Example
This handler starts the timer counting, resets the timer to 0, and then has the timer count up to
60 ticks:
on countTime
startTimer
repeat while the timer < 60
-- waiting for time
end repeat
end countTime
See also
exit, exit repeat, repeat with, keyPressed()
repeat with
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 Control+Alt+period (Windows) or Command+period (Macintosh).