03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Looping is commonly used to perform an action while a counter variable is less than a<br />

specified value. At the end of each loop, the counter is incremented until the specified value is<br />

reached. At that point, the condition is no longer true, <strong>and</strong> the loop ends.<br />

The curly braces ({}) used to enclose the block of statements to be executed by the while<br />

statement are not necessary if only one statement will execute.<br />

Parameters<br />

condition:Boolean - An expression that evaluates to true or false.<br />

Example<br />

In the following example, the while statement is used to test an expression. When the value<br />

of i is less than 20, the value of i is traced. When the condition is no longer true, the loop<br />

exits.<br />

var i:Number = 0;<br />

while (i < 20) {<br />

trace(i);<br />

i += 3;<br />

}<br />

The following result is displayed in the Output panel.<br />

0<br />

3<br />

6<br />

9<br />

12<br />

15<br />

18<br />

See also<br />

continue statement<br />

with statement<br />

with (object:Object) { statement(s); }<br />

Lets you specify an object (such as a movie clip) with the object parameter <strong>and</strong> evaluate<br />

expressions <strong>and</strong> actions inside that object with the statement(s) parameter. This prevents<br />

you from having to repeatedly write the object's name or the path to the object.<br />

Statements 207

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!