MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 228

Actionscript language reference
Table of Contents

Advertisement

while
Availability
Flash Player 4.
Usage
while(condition) {
statement(s);
}
Parameters
An expression that evaluates to
condition
statement(s)
Returns
Nothing.
Description
Statement; evaluates a condition and if the condition evaluates to
of statements before looping back to evaluate the condition again. After the condition evaluates to
, the statement or series of statements is skipped and the loop ends.
false
The
statement performs the following series of steps. Each repetition of steps 1 through 4
while
is called an iteration of the loop. The
shown in the following steps:
The expression
1.
If
2.
condition
nonzero number, go to step 3.
Otherwise, the
after the
while
Run the statement block
3.
Go to step 1.
4.
Looping is commonly used to perform an action while a counter variable is less than a specified
value. At the end of each loop, the counter is incremented until the specified value is reached. At
that point, the
condition
The curly braces (
statement are not necessary if only one statement will execute.
Example
In the following example, the
is less than 20, the value of
var i:Number = 0;
while (i<20) {
trace(i);
228
Chapter 5: ActionScript Core Language Elements
ActionScript Core Language Elements
The instructions to execute if the condition evaluates to
condition
is evaluated.
condition
evaluates to
or a value that converts to the Boolean value
true
statement is completed and execution resumes at the next statement
while
loop.
statement(s)
is no longer
) used to enclose the block of statements to be executed by the
{}
statement is used to test an expression. When the value of
while
is traced. When the condition is no longer
i
or
.
true
false
is retested at the beginning of each iteration, as
.
, and the loop ends.
true
CHAPTER 5
.
true
, runs a statement or series
true
, such as a
true
while
, the loop exits.
true
i

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents