Pergunta

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?

Foi útil?

Solução 3

it's explained here: Perspective in Flash

Outras dicas

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.

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top