DepthManager class

ActionScript Class Name mx.managers.DepthManager

The DepthManager class allows you to manage the relative depth assignments of any component or movie clip, including _root. It also lets you manage reserved depths in a special highest-depth clip on _root for system-level services such as the pointer and tooltips.

NOTE

The DepthManager class is supported only if you are working in a document that specifies ActionScript 2.0 in its Publish Settings.

In general, Depth Manager manages components automatically, using its own "shuffling" algorithm. You do not need to use its APIs unless you are an advanced Flash developer.

TIP

To use the DepthManager class for movie clip instances, you need to have a component in the library or on the Stage, and use "import mx.managers.DepthManager" at the beginning of your ActionScript.

The following methods constitute the relative depth-ordering API:

The following methods constitute the reserved depth space API:

Method summary for the DepthManager class

The following table lists the methods of the DepthManager class.

Method

Description

DepthManager.createChildAtDepth()

Creates a child of the specified symbol at the specified depth.

DepthManager.createClassChildAtDepth()

Creates an object of the specified class at the specified depth.

DepthManager.createClassObjectAtDepth()

Creates an instance of the specified class at a specified depth in the special highest-depth clip.

DepthManager.createObjectAtDepth()

Creates an object at a specified depth in the highest-depth clip.

DepthManager.setDepthAbove()

Sets the depth above the specified instance.

DepthManager.setDepthBelow()

Sets the depth below the specified instance.

DepthManager.setDepthTo()

Sets the depth to the specified instance in the highest-depth clip.

Property summary for the DepthManager class

The following table lists the properties of the DepthManager class. The constant values shown are the default values that the DepthManager algorithm uses to arrange depth. If you trace the following properties, you will see those constant values in the Output panel.

However, after you implement a DepthManager method, such as DepthManager.setDepthTo(), using one of the following properties, and then trace the component or movie clip depth, you see that DepthManager sets the depths in increments of 20. The algorithm increments depths in case Flash needs to insert something else in the middle, based on other scripts, components, and so on.

Property

Description

DepthManager.kBottom

A static property with the constant value 202.

DepthManager.kCursor

A static property with the constant value 101. This is the cursor depth.

DepthManager.kNotopmost

A static property with the constant value 204.

DepthManager.kTooltip

A static property with the constant value 102. This is the tooltip depth.

DepthManager.kTop

A static property with the constant value 201.

DepthManager.kTopmost

A static property with the constant value 203.