Name
MovieClip.swapDepths( ) Method — change the graphic layering of an instance in the instance stack
Availability
Flash 5
Synopsis
mc.swapDepths(target) mc.swapDepths(depth)
Arguments
- target
A string indicating the path to the movie clip to be swapped with
mc
. Because movie clip references are converted to paths when used in a string context,target
may also be a movie clip object reference, as inmc
.swapDepths(window2)
versusmc
.swapDepths("window2")
.
- depth
An integer specifying a level in
mc
’s parent’s clip stack. A depth of -1 is below 0, 1 is in front of 0, 2 is in front of 1, and so on. See Section 13.4 in Chapter 13 for more details. Negative depths are functional, but not officially supported by ActionScript; to ensure future compatibility, use depths of or greater.
Description
All movie clip instances in a .swf
document
reside in a stack that governs the visual layering of instances in
the Player. The stack is structured like a deck of cards; clips in
higher positions in the stack appear in front of clips in lower
positions. The position of an instance in the stack is initialized
when the clip is created (either in the Flash authoring tool or via
attachMovie( )
or duplicateMovieClip(
)
). Using swapDepths( )
, we can
change the position of an instance in the stack.
The swapDepths( )
method takes two forms. When
used with a target
argument,
swapDepths( )
trades the stack position of
mc
and target
,
provided that mc
and
target
share the same parent clip (reside on the same timeline). ...
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.