# set variable

#### Availability

Flash Player 4.

#### Usage

    set(variable, expression)

#### Parameters

`variable` An identifier to hold the value of the `expression` parameter.

`expression` A value assigned to the variable.

#### Returns

Nothing.

#### Description

Action; assigns a value to a variable. A variable is a container that holds data. The container itself is always the same, but the contents can change. By changing the value of a variable as the movie plays, you can record and save information about what the user has done, record values that change as the movie plays, or evaluate whether a condition is `true` or `false`.

Variables can hold any data type (for example, string, number, Boolean, object, or movie clip). The Timeline of each movie and movie clip has its own set of variables, and each variable has its own value independent of variables on other timelines.

ActionScript is a dynamically typed language. Every variable has a type. The type is assigned at runtime and can change during execution. This is unlike a statically typed language like Java or C++ where the type is assigned at compile time and cannot change at runtime.

#### Example

This example sets a variable called `orig`_`x_pos`, which stores the original x axis position of the `ship` movie clip in order to reset the ship to its starting location later in the movie.

    on(release) {
    	set("orig_x_pos", getProperty ("ship", _x ));
    }

The previous code gives the same result as the following code:

    on(release) {
    	orig_x_pos = ship._x;
    }

#### See also

`var`, `call`