This content has been marked as final. Show 3 replies
I'm still fairly new to Flex, but one thing that I've noticed is that the order that the fields are displayed in your application determine which item is on top of the other.
---<mx:Panel>the earlier the item was created, the lower it exists</mx:Panel>
---<mx:Panel> top element </mx:Panel>
So it's almost like it goes by the age of the field, when ever you add a new field it adds it after all of the other child elements.
I personally haven't found a way to dynamically (thru ActionScript) set a element higher or lower then the other.
Every time you use addChild() method it adds the component to the end of the components lists. And Flex displays last objects on top of the other objects.
So, if you want to control the appearance of the objects you should use addChildAt(object, position) method. Position starts from 0. And be careful with indices - there should not be gaps.
You can also alter the layering dynamically as well. Below is one method that I
just used in an application
cv is the container (in this case a canvas)
obj is an entry control that is about to become visible and wants to be on top.
This moves obj to the top of the display list.
private function moveToTop(obj:DisplayObject):void
var lastIdx:int = cv.getChildren().length -1;