MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference page 32

Director scripting reference
Table of Contents

Advertisement

The following example performs a similar action, but with decreasing numbers:
-- Lingo syntax
repeat with n = 10 down to 2
sprite(n).ink = 36
end repeat
// JavaScript syntax
for (var n=10; n>=2; n--) {
sprite(n).ink = 36;
}
In Lingo, to repeat a set of instructions as long as a specific condition exists, use the
structure.
while
In JavaScript syntax, to repeat a set of instructions as long as a specific condition exists, use the
structure.
while
For example, the following statements instruct a movie to beep continuously whenever the mouse
button is being pressed:
-- Lingo syntax
repeat while _mouse.mouseDown
_sound.beep()
end repeat
// JavaScript syntax
while (_mouse.mouseDown) {
_sound.beep();
}
Both Lingo and JavaScript syntax scripts continue to loop through the statements inside the loop
until the condition is no longer true, or until one of the statements sends the script outside the
loop. In the previous example, the script exits the loop when the mouse button is released because
the
condition is no longer true.
mouseDown
In Lingo, to exit a loop, use the
In JavaScript syntax, to exit a loop you can use the term
when a condition is no longer true.
For example, the following statements make a movie beep while the mouse button is pressed,
unless the mouse pointer is over sprite 1. If the pointer is over sprite 1, the script exits the
loop and stops beeping. The
specified sprite.
-- Lingo syntax
repeat while _mouse.stillDown
_sound.beep()
if _movie.rollOver(1) then exit repeat
end repeat
// JavaScript syntax
while (_mouse.stillDown) {
_sound.beep();
if (_movie.rollOver(1)) {
break;
}
}
For reference information on the
on page
220.
32
Chapter 2: Director Scripting Essentials
statement.
exit repeat
method indicates whether the pointer is over the
rollover()
and
repeat while
. A loop also automatically exits
break
structures, see
"repeat while"
while
repeat

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Director mx 2004

Table of Contents