MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 142

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

For more information on each statement, see the following topics:
"About compound statements" on page 142
"About conditions" on page 142
"Repeating actions using loops" on page 153
About compound statements
A compound statement contains numerous statements that you enclose within curly brace
(
) punctuators. The statements inside a compound statement can be any kind of
{}
ActionScript statement. A typical compound statement is shown below.
The statements within the curly brace punctuators are indented from the compound
statement, as the following ActionScript shows:
var a:Number = 10;
var b:Number = 10;
if (a == b) {
// This code is indented.
trace("a == b");
trace(a);
trace(b);
}
This compound statement contains several statements, but acts like a single statement in your
ActionScript code. The opening brace is placed at the end of the compound statement. The
closing brace begins a line, and aligns with the beginning of the compound statement.
For more information on using braces, see
About conditions
You use conditions to determine whether something is true or exists, and then you can
optionally repeat an action (using loops), or execute actions that you specify, such as functions
or expressions, based on whether the condition is true or not. For example, you can determine
whether a certain variable is defined or has a certain value and execute a block of code based
on the result. Also, you could change the graphics within your Flash document based on what
time the user's system clock is set to or on the weather in the user's current location.
To perform an action depending on whether a condition exists, or to repeat an action (create
loop statements), you can use
statements.
142
Syntax and Language Fundamentals
"Curly braces" on page
,
,
,
if
else
else if
for
126.
,
,
,
while
do while
for..in
, or
switch

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents