else
Availability
Flash Player 4.
Usage
if (condition){
statement(s);
} else {
statement(s);
}
Parameters
An expression that evaluates to
condition
statement(s)
statement is
false
Returns
Nothing.
Description
Statement; specifies the statements to run if the condition in the
curly braces (
) used to enclose the block of statements to be executed by the
{}
not necessary if only one statement will execute.
Example
In the following example, the
greater than or less than 18:
if (age_txt.text>=18) {
trace("welcome, user");
} else {
trace("sorry, junior");
userObject.minor = true;
userObject.accessAllowed = false;
}
In the following example, curly braces
the
statement:
else
if (age_txt.text>18) {
trace("welcome, user");
}
else trace("sorry, junior");
See also
if,
else
if,
ActionScript Core Language Elements
An alternative series of statements to run if the condition specified in the
.
condition is used to check whether the
else
switch
or
.
true
false
are not necessary because only one statement follows
({})
CHAPTER 5
statement returns
if
false
statement are
else
variable is
age_txt
if
. The
else
149
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?