PDA

View Full Version : Layer or z-index


john100
04-27-2006, 04:39 AM
this seems like a simple question. But I cannot find where to set the z-index for canvas.

so like html page. I want to position one canvas over the top of other or vice versa.



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute">
<mx:Canvas width="200" height="200" backgroundColor="#8000ff" x="214" y="24">
</mx:Canvas>
<mx:Canvas width="200" height="200" backgroundColor="#ff8080" x="422" y="24">
</mx:Canvas>
</mx:Application>

Tink
04-27-2006, 09:10 AM
z-index is now the child index ( was depths in the previous player ).

USing MXML will automatically add you components to the displayList at a specific child index. the index 0 is at the top and subsiquent numbers will appear underneath.

So in your example the first the first canvas is added at child index 0, the second at child index 1, therefore the first canvas is on top of the second.

john100
04-28-2006, 02:52 AM
thanks for the feedback. I found setChildIndex