View comments | RSS feed

_level

Availability

Flash Player 4.

Usage

_levelN

Description

Identifier; a reference to the root Timeline of _levelN. You must use loadMovieNum() to load SWF files into the Flash Player before you use the _level property to target them. You can also use _levelN to target a loaded SWF file at the level assigned by N.

The initial SWF file loaded into an instance of the Flash Player is automatically loaded into _level0. The SWF file in _level0 sets the frame rate, background color, and frame size for all subsequently loaded SWF files. SWF files are then stacked in higher-numbered levels above the SWF file in _level0.

You must assign a level to each SWF file that you load into the Flash Player using loadMovieNum(). You can assign levels in any order. If you assign a level that already contains a SWF file (including _level0), the SWF file at that level is unloaded and replaced by the new SWF file.

Example

The following example stops the playhead in the main Timeline of the SWF file sub.swf that is loaded into _level9. The sub.swf file contains animation and is in the same directory as the document that contains the following ActionScript:

loadMovieNum("sub.swf", 9);
myBtn_btn.onRelease = function() {
   _level9.stop();
};

You could replace _level9.stop() in the previous example with the following code:

_level9.gotoAndStop(5);

This action sends the playhead in the main Timeline of the SWF file in _level9 to Frame 5 instead of stopping the playhead.

See also

loadMovie(), MovieClip.swapDepths()

Comments


logeye said on Oct 15, 2004 at 3:32 PM :
Your documentation says, "You must use loadMovieNum() to load SWF files into the Flash Player before you use the _level property to target them."

Must the entire swf file be completely loaded into a level in order to communicate with it?

I want to use a preloader in _level0 to find the _currentframe() and _totalframes() of the swf loaded into some higher _level. When I try this with larger files it does not work until the file is completely loaded.

How can I communicate with a partially loaded file in _levelxx?

Thanks,
Francis Cheng said on Jan 27, 2005 at 9:26 AM :
The Flash Player has a hierarchical stacking order, the root of which is the level system. Each level can contain one SWF file that is loaded using loadMovieNum() or MovieClipLoader.loadClip(). Within each SWF file, the stacking order of that SWF file’s assets (i.e. graphics, movie clips, text fields, etc.) is controlled by the depth value. You cannot use swapdepths() to move between levels because the depth value only deals with the internal stacking order of a SWF file on a given level.
No screen name said on Jan 28, 2005 at 11:12 AM :
What is the maximum value for _level? eg _level30000000
Francis Cheng said on Feb 2, 2005 at 11:17 PM :
The maximum value for _level is a little over 2 billion.
cognitia said on May 5, 2005 at 1:39 AM :
I have loaded external swf files using the moviecliploader class method which works fine and appears to load it into the correct level eg: _level2.
However, trying to control this swf with the recommended _level2.gotoAndPlay(2); doesn't seem to work.
Is this the correct syntax to control external swfs if it has been loaded by this method

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001403.html