var

Availability

Flash Player 5.

Usage

var variableName [= value1] [...,variableNameN [=valueN]]

Parameters

variableName An identifier.

value The value assigned to the variable.

Returns

Nothing.

Description

Note: Action; used to declare local or non-local variables. If you declare variables inside a function, the variables are local. They are defined for the function and expire at the end of the function call. If variables are not declared inside a block ({}), but the action list was executed with a call action, the variables are local and expire at the end of the current list. If variables are not declared inside a block and the current action list was not executed with the call action, the variables are not local. Classes defined in external scripts also support public, private, and static variable scopes. For more information, see Creating classes with ActionScript 2 and private, public, and static.

Example

The following examples use the var action to declare and assign variables:

var x;
var y = 1;
var z = 3, w = 4;
var s, t, u = z;