views:

45

answers:

3

i'm having a difficult time understanding how to control the z property of display objects in a 3D space. i know how depth works, but what i don't understand is how i can get the maximum depth, or the number at which the display object just disappears into the background.

i assume depth is based on the stage's width and height, and that is why assigning the same depth of the same display object appars mismatched with different stage sizes.

so how can i appropriately measure depth?

A: 

Hi,

You need to consider the childIndex property. There is no Z-index in actionscript.

To get the depth you could use:

// returns the number of direct display children in stage
stage.numChildren; 

// returns the number of direct display children in you object
myObj.numChildren; 

To set the child Z-index use

//sets the newIndex of child in stage
stage.setChildIndex(child:DisplayObject, newIndex:int):void; 

If newIndex is 0 then child is top visible element.

newIndex must be in [0, numChildren-1] else flash will throw errors

Take care.

Adrian Pirvulescu
you have misunderstood my question. i'm talking about the z property of a display object in a 3D space, not the display list index. i've edited my question to reference 3D.
TheDarkInI1978
That makes all the sense in the word. Your question was out of scope.In that case there is a Z index and you should check the adobe docs for 3d. it is well described in there what you need to do
Adrian Pirvulescu
it's not. the documentation doesn't mention the information i'm searching for at all.
TheDarkInI1978
A: 

As of Flash 10, there is a 'z' property.

Checkout this link for a tutorial: http://www.kirupa.com/developer/as3/intro_3d_as3_pg1.htm

ablerman
A: 

it's explained here: Perspective in Flash

TheDarkInI1978