If Statement - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Enter the following ActionScript in a frame on the Timeline:
var giants:Team = new Team("San Fran", "SFO");
trace(giants.name);
giants.name = "San Francisco";
trace(giants.name);
/* output:
San Fran San Francisco */
When you trace giants.name, you use the
See also
addProperty (Object.addProperty method)

if statement

if(condition) { statement(s); }
Evaluates a condition to determine the next action in a SWF file. If the condition is
Flash runs the statements that follow the condition inside curly braces (
, Flash skips the statements inside the curly braces and runs the statements following
false
the curly braces. Use the
branching logic in your scripts.
The curly braces (
) used to enclose the block of statements to be executed by the
{}
statement are not necessary if only one statement will execute.
Availability: ActionScript 1.0; Flash Lite 1.0
Parameters
condition:Boolean
Example
In the following example, the condition inside the parentheses evaluates the variable
see if it has the literal value
runs.
if(name == "Erica"){
play();
}
get
statement along with the
if
- An expression that evaluates to
. If it does, the
"Erica"
method to return the value of the property.
and
else
else if
or
true
false
function inside the curly braces
play()
,
true
). If the condition is
{}
statements to create
if
.
name
Statements
to
201

Advertisement

Table of Contents
loading

Table of Contents