O'Reilly logo

ActionScript: The Definitive Guide by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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;

Cancels a loop

call

call (frame);

Executes the script on a remote frame

continue

continue;

Restarts the current loop

do-while

do {
   statements
} while (expression);

A variation of a while loop

empty statement

;

Holds a place where a statement is expected, and used with evaluate in novice mode

for

for (init; test; increment) {
   statements
}

Executes some code 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 some code based on a condition or a series of conditions

ifFrameLoaded

ifFrameLoaded (frame) {
   statements
}

Executes some code if a certain frame has loaded; deprecated in Flash 5

return

return;
return expression;

Exits a function or returns a value from a function

set

set (variable, value);

Assigns a value to a dynamically named variable

var

var variableName;
var variableName = expression;

Declares and optionally initializes a variable

while

while (expression) {
   statements
}

Executes some code repetitively (a while loop)

with

with (objectName ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required