Getdepth (Button.getdepth Method) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

getDepth (Button.getDepth method)

public getDepth() : Number
Returns the depth of the button instance.
Each movie clip, button, and text field has a unique depth associated with it that determines
how the object appears in front of or in back of other objects. Objects with higher depths
appear in front.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
- The depth of the button instance.
Number
Example
If you create
and
on the Stage, you can trace their depth using the
myBtn1_btn
myBtn2_btn
following ActionScript:
trace(myBtn1_btn.getDepth());
trace(myBtn2_btn.getDepth());
If you load a SWF file called buttonMovie.swf into this document, you could trace the depth
of a button,
, inside that SWF file using another button in the main SWF:
myBtn4_btn
this.createEmptyMovieClip("myClip_mc", 999);
myClip_mc.loadMovie("buttonMovie.swf");
myBtn3_btn.onRelease = function(){
trace(myClip_mc.myBtn4_btn.getDepth());
};
You might notice that two of these buttons have the same depth value, one in the main SWF
file and one in the loaded SWF file. This is misleading, because buttonMovie.swf was loaded
at depth 999, which means that the button it contains will also have a depth of 999 relative to
the buttons in the main SWF file. Keep in mind that each movie clip has its own internal z-
order, which means that each movie clip has its own set of depth values. The two buttons may
have the same depth value, but the values only have meaning in relation to other objects in the
same z-order. In this case, the buttons have the same depth value, but the values relate to
different movie clips: the depth value of the button in the main SWF file relates to the z-order
of the main Timeline, while the depth value of the button in the loaded SWF file relates to
the internal z-order of the myClip_mc movie clip.
See also
,
getDepth (MovieClip.getDepth method)
getDepth (TextField.getDepth method)
Button
277

Advertisement

Table of Contents
loading

Table of Contents