I have a menu set up that has about 20 menu items in a circle. When you mouse over each item, a title comes up. The only problem is that because of the depth order, it's hidden behind the other menu items. Is there a way to bring this item to the front when moused over? I'm pretty actionscript illiterate so any help would be awesome.
+1
A:
You can move an item to the top by re-adding it to the display list, using addChild(item), even if it is already added as a child. Something in the lines of this:
function onMouseOver(e:MouseEvent) {
e.target.parent.addChild(e.target);
}
It may feel a bit odd to use this approach, instead of other possible methods to move stuff around in a display list, but since addChild(object) first removes the object from a display list, before adding it, it will work just fine.
Lars
2010-05-23 22:00:50
+1
A:
If you don't want your object being removed and then added to the display list using addChild
you can use setChildIndex
var parent:DisplayObjectContainer = myElement.parent;
parent.setChildIndex(myElement, parent.numChildren-1);
Patrick
2010-05-23 22:38:23