Name

_leveln Global Property — a document level in the Player

Availability

Flash 3 and later

Synopsis

_level0
_level1
_level2
...
_leveln

Access

Read-only

Description

Multiple .swf files may be loaded into the Flash Player for simultaneous display. Each loaded .swf resides on its own level in the document level stack. (A .swf file on a higher level number will obscure lower levels if they occupy the same portion of the Stage.) The _level n property stores a reference to the main timeline of a .swf loaded into a document level in the Player. Each document level is represented by a numbered property, such as _level0, _level1, _level2, and so on.

The original document loaded into any Flash Player is considered _level0.

Example

A _level n reference is normally used to control movies on other levels of the document stack. For example, here we play the movie on level 2:

_level2.play( );

We can also use _level n in combination with movie clip references to control clips contained by a movie on any level in the document stack. For example:

_level1.orderForm.titleBar.play( );

A _level n reference may also be used as the value of the target argument of several functions, including loadMovie( ), unloadMovie( ), loadVariables( ) and print( ). If the level does not yet exist, you should specify the level reference within quotes. If used without quotes, a nonexistent level is considered undefined and may cause the command to operate on the current timeline instead of the new, undefined level. For example, ...

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.