03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Enter the following <strong>ActionScript</strong> in a frame on the Timeline:<br />

var giants:Team = new Team("San Fran", "SFO");<br />

trace(giants.name);<br />

giants.name = "San Francisco";<br />

trace(giants.name);<br />

/* output:<br />

San Fran San Francisco */<br />

When you trace giants.name, you use the get method to return the value of the property.<br />

See also<br />

addProperty (Object.addProperty method)<br />

if statement<br />

if(condition) {<br />

statement(s);<br />

}<br />

Evaluates a condition to determine the next action in a SWF file. If the condition is true,<br />

Flash runs the statements that follow the condition inside curly braces ({}). If the condition is<br />

false, Flash skips the statements inside the curly braces <strong>and</strong> runs the statements following<br />

the curly braces. Use the if statement along with the else <strong>and</strong> else if statements to create<br />

branching logic in your scripts.<br />

The curly braces ({}) used to enclose the block of statements to be executed by the if<br />

statement are not necessary if only one statement will execute.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 4<br />

Parameters<br />

condition:Boolean - An expression that evaluates to true or false.<br />

Example<br />

In the following example, the condition inside the parentheses evaluates the variable name to<br />

see if it has the literal value "Erica". If it does, the play() function inside the curly braces<br />

runs.<br />

if(name == "Erica"){<br />

play();<br />

}<br />

Statements 219

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

Saved successfully!

Ooh no, something went wrong!