MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 130

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Determining the next highest available depth
To determine the next highest available depth within a movie clip, use
MovieClip.getNextHighestDepth()
next available depth that will render in front of all other objects in the movie clip.
The following code creates a new movie clip, with a depth value of 10, on the Timeline of the
movie clip named
movie clip, and creates a new movie clip at that depth.
menus_mc.attachMovie("menuClip","file_menu", 10);
var nextDepth = menus_mc.getNextHighestDepth();
menus_mc.attachMovie("menuClip", "edit_menu", nextDepth);
In this case, the variable named
available depth for the movie clip
To obtain the current highest occupied depth, subtract 1 from the value returned by
getNextHighestDepth()
particular depth" on page
Determining the instance at a particular depth
To determine the instance at particular depth, use
method returns a reference to the instance at the specified depth.
The following code combines
determine the movie clip at the (current) highest occupied depth on the root Timeline.
var highestOccupiedDepth = _root.getNextHighestDepth() - 1;
var instanceAtHighestDepth = _root.getInstanceAtDepth(highestOccupiedDepth);
For more information, see
Determining the depth of an instance
To determine the depth of a movie clip instance, use
The following code iterates over all the movie clips on a SWF file's main Timeline and displays
each clip's instance name and depth value in the Output panel.
for(each in _root) {
var obj = _root[each];
if(obj instanceof MovieClip) {
var objDepth = obj.getDepth();
trace(obj._name + ":" + objDepth)
}
}
For more information, see
Swapping movie clip depths
To swap the depths of two movie clips on the same Timeline, use
more information, see
130
Chapter 7: Working with Movie Clips
. The integer value returned by this method indicates the
. It then determines the next highest available depth in that same
menus_mc
nextDepth
menus_mc
, as shown in the next section (see
130).
getNextHighestDepth()
MovieClip.getInstanceAtDepth()
MovieClip.getDepth()
MovieClip.swapDepths()
contains the value 11, because that's the next highest
.
"Determining the instance at a
MovieClip.getInstanceAtDepth()
and
getInstanceAtDepth()
on page
MovieClip.getDepth()
on page
503.
MovieClip.swapDepths()
on page
535.
. This
to
503.
.
. For

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Table of Contents