Adding and removing DisplayObjects from DisplayObjectContainer

index

index is a sequentially numbered integer starting from 0, with 0 being the farthest back and higher values being the farthest forward. The index cannot be a negative value or a number greater than the current highest index plus one.

addChild

addChild method adds a DisplayObject to the foremost position in the DisplayObjectContainer.

addChild

Example

addChildAt

addChildAt method adds a DisplayObject to the specified index position in the DisplayObjectContainer.

addChildAt

Example

removeChild, removeChildAt

removeChild and removeChildAt methods remove the specified DisplayObject from the DisplayObjectContainer. If there are any DisplayObjects after the removed index, they will be relocated to a smaller index position.

addChildAt

Example

Next Chapter