Checking and changing the overlapping order of DisplayObjects in a container

getChildIndex

getChildIndex method returns the index of the DisplayObject specified by the argument in the order of overlap.

Example

setChildIndex

The setChildIndex function repositions the DisplayObject specified in the first argument to the position specified in the second argument. This repositioning can be done in the same way with the addChildAt method.

swapChildren

The swapChildren function swaps the overlapping order (index position) of two DisplayObjects specified by the argument.

swapChildrenAt

The swapChildrenAt function swaps the overlapping order (index position) of two DisplayObjects specified by the argument index. The addChild method is used to reposition a DisplayObject to the top level.

Next Chapter