User Guide

Statements 223
Parameters
condition:Boolean - An expression that evaluates to true or false.
Example
In the following example, the while statement is used to test an expression. When the value
of
i is less than 20, the value of i is traced. When the condition is no longer true, the loop
exits.
var i:Number = 0;
while (i < 20) {
trace(i);
i += 3;
}
The following result is displayed in the Output panel.
0
3
6
9
12
15
18
See also
continue statement
with statement
with (object:Object) { statement(s); }
Lets you specify an object (such as a movie clip) with the object parameter and evaluate
expressions and actions inside that object with the
statement(s) parameter. This prevents
you from having to repeatedly write the object's name or the path to the object.
The
object parameter becomes the context in which the properties, variables, and functions
in the
statement(s) parameter are read. For example, if object is my_array, and two of the
properties specified are
length and concat, those properties are automatically read as
my_array.length and my_array.concat. In another example, if object is
state.california, any actions or statements inside the with statement are called from
inside the
california instance.
To find the value of an identifier in the
statement(s) parameter, ActionScript starts at the
beginning of the scope chain specified by the
object and searches for the identifier at each
level of the scope chain, in a specific order.