Reputation: 3620
I am wondering if it is possible to set the display order of your canvas' programmatically?
For Example i have
<mx:Canvas id="head">
...content...
</mx:Canvas>
<mx:Canvas id="shoulders">
...content...
</mx:Canvas>
<mx:Canvas id="knees">
...content...
</mx:Canvas>
<mx:Canvas id="toes">
...content...
</mx:Canvas>
could i set a variable to define the order the canvas' are displayed? so i could have [head, shoulders, toes, knees] for one user and [toes, head, shoulders, knees] for another?
Upvotes: 0
Views: 144
Reputation: 39408
You can use the methods swapChildren and swapChildrenAt to change the Z-order of a component's children.
In MXML, children are created in the order they are displayed, so if you want knees to be above shoulders, you'll have to change the order of your components, like this:
<mx:Canvas id="head">
...content...
</mx:Canvas>
<mx:Canvas id="knees">
...content...
</mx:Canvas>
<mx:Canvas id="shoulders">
...content...
</mx:Canvas>
<mx:Canvas id="toes">
...content...
</mx:Canvas>
Or you could use the above methods to change the order after the fact.
Upvotes: 1