70
Flash Lite Statements
else if
Availability
Flash Lite 1.0.
Usage
if (
condition
){
statement(s)
;
} else if (
condition
){
statement(s)
;
}
Parameters
condition
An expression that evaluates to
true
or
false
.
statement(s)
A series of statements to run if the condition specified in the
if
statement
is
false
.
Description
Statement; evaluates a condition and specifies the statements to run if the condition in the
initial
if
statement returns a
false
value. If the
else if
condition returns a
true
value, the
Flash interpreter runs the statements that follow the
else if
condition inside curly braces
(
{}
). If the
else if
condition is
false
, Flash skips the statements inside the curly braces and
runs the statements following the curly braces. Use the
else
if
statement to create branching
logic in your scripts.
Example
The following example uses
else if
statements to check whether each side of an object is
within a specific boundary:
person_mc.xPos = 100;
leftBound = 0;
rightBound = 100;
if (person_mc.xPos <= leftBound) {
//trace ("Clip is to the far left");
} else if (person_mc.xPos >= rightBound) {
//trace ("Clip is to the far right");
} else {
//trace ("Your clip is somewhere in between");
}
See also
if
Summary of Contents for FLASH 8-FLASH
Page 1: ...Flash Lite 1 x ActionScript Language Reference...
Page 6: ...6 Contents...
Page 46: ...46 Flash Lite Global Functions...
Page 62: ...62 Flash Lite Properties...
Page 76: ...76 Flash Lite Statements...
Page 110: ...110 Flash Lite Operators...
Page 162: ...162 Index...