![MACROMEDIA Flash Lite 2 Скачать руководство пользователя страница 201](http://html1.mh-extra.com/html/macromedia/flash-lite-2/flash-lite-2_reference_687553201.webp)
Statements
201
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
get
method to return the value of the property.
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
true
,
Flash runs the statements that follow the condition inside curly braces (
{}
). If the condition is
false
, Flash skips the statements inside the curly braces and runs the statements following
the curly braces. Use the
if
statement along with the
else
and
else if
statements to create
branching logic in your scripts.
The curly braces (
{}
) used to enclose the block of statements to be executed by the
if
statement are not necessary if only one statement will execute.
Availability:
ActionScript 1.0; Flash Lite 1.0
Parameters
condition
:
Boolean
- An expression that evaluates to
true
or
false
.
Example
In the following example, the condition inside the parentheses evaluates the variable
name
to
see if it has the literal value
"Erica"
. If it does, the
play()
function inside the curly braces
runs.
if(name == "Erica"){
play();
}
Содержание Flash Lite 2
Страница 1: ...Flash Lite 2 x ActionScript Language Reference...
Страница 22: ...22 Contents...
Страница 244: ...244 ActionScript language elements...
Страница 760: ...760 ActionScript classes...