![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Every movie clip has its own z-order space that determines how objects overlap within its parent SWF file or movie clip. Every movie clip has an associated depth value, which determines if it will render in front of or behind other movie clips in the same movie clip Timeline. When you create a movie clip at runtime using MovieClip.attachMovie()
, MovieClip.duplicateMovieClip()
, or MovieClip.createEmptyMovieClip()
, you always specify a depth for the new clip as a method parameter. For example, the following code attaches a new movie clip to the Timeline of a movie clip named container_mc
with a depth value of 10.
container_mc.attachMovie("symbolID", "clip_1", 10);
This creates a new movie clip with a depth of 10 within the z-order space of container_mc
.
For example, the following code attaches two new movie clips to container_mc
. The first clip, named clip_1
, will render behind clip_2
, because it was assigned a lower depth value.
container_mc.attachMovie("symbolID", "clip_1", 10); container_mc.attachMovie("symbolID", "clip_2", 15);
Depth values for movie clips can range from -16384 to 1048575.
The MovieClip class provides several methods for managing movie clip depths: see MovieClip.getNextHighestDepth()
, MovieClip.getInstanceAtDepth()
, MovieClip.getDepth()
, and MovieClip.swapDepths()
.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |