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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

If the condition always evaluates to true, the do..while loop is infinite. If you enter an<br />

infinite loop, you encounter problems with Flash Player <strong>and</strong> eventually get a warning message<br />

or crash the player. Whenever possible, you should use a for loop if you know the number of<br />

times you want to loop. Although for loops are easy to read <strong>and</strong> debug, they cannot replace<br />

do..while loops in all circumstances.<br />

Parameters<br />

condition:Boolean - The condition to evaluate. The statement(s) within the do block of<br />

code will execute as long as the condition parameter evaluates to true .<br />

Example<br />

The following example uses a do..while loop to evaluate whether a condition is true, <strong>and</strong><br />

traces myVar until myVar is greater than 5. When myVar is greater than 5, the loop ends.<br />

var myVar:Number = 0;<br />

do {<br />

trace(myVar);<br />

myVar++;<br />

}<br />

while (myVar < 5);<br />

/* output:<br />

0<br />

1<br />

2<br />

3<br />

4<br />

*/<br />

See also<br />

break statement<br />

dynamic statement<br />

dynamic class className [ extends superClass ] [ implements interfaceName[,<br />

interfaceName... ] ] { // class definition here }<br />

Specifies that objects based on the specified class can add <strong>and</strong> access dynamic properties at<br />

runtime.<br />

176 ActionScript language elements

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

Saved successfully!

Ooh no, something went wrong!