• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Statements > The ActionScript Statements

6.3. The ActionScript Statements

Now that you know how a typical statement is formed, skim Table 6-1 to acquaint yourself with some of the things that ActionScript statements do.

Table 6-1. The ActionScript statements
Statement Syntax Use
break
break;

Aborts a loop or switch statement
case
case expression:
  statements

Identifies a statement to be executed conditionally in a switch statement
continue
continue;

Skips the remaining statements in the current loop and begins the next iteration at the top of the loop
default
default:
   statements

Identifies the statement(s) to execute in a switch statement when the test expression does not match any case clauses
do-while
do {
   statements
} while (expression);

A variation of a while loop that ensures at least one iteration of the loop is performed
empty statement
;

Holds a place where a statement is expected; used with evaluate in Normal Mode
for
for (init; test; increment) {
   statements
}

Executes a statement block repetitively (a for loop)
for-in
for (property in object) {
   statements
}

Enumerates the properties of an object
function
function name (parameters) {
   statements
}

Declares a function
if-else if-else
if (expression) {
   statements
} else if (expression) {
   statements
} else {
   statements
}

Executes one or more statements, based on a condition or a series of conditions
ifFrameLoaded
ifFrameLoaded (frame) {
   statements
}

Executes specified code if a certain frame has loaded; deprecated as of Flash 5
return
return;
return expression;

Exits and optionally returns a value from a function
set
set(variable, value);

Assigns a value to a dynamically named variable
switch
switch (expression) {
  statements
}

Executes specified code, based on a condition or a series of conditions (alternative to if-else if-else)
var
var variableName;
var variableName = expression;

Declares and optionally initializes a variable
while
while (expression) {
   statements
}

Executes a statement block repetitively (a while loop)
with
with (objectName) {
   statements
}

Executes a statement block in the scope of a given object



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint