Thursday, April 16, 2009

DisplayObjectContainer - Flash CS4 Professional ActionScript 3.0 Language Reference

DisplayObjectContainer - Flash CS4 Professional ActionScript 3.0 Language Reference

addChild () method
public function addChild(child:DisplayObject):DisplayObject

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 9, AIR 1.0

Adds a child DisplayObject instance to this DisplayObjectContainer instance. The child is added to the front (top) of all other children in this DisplayObjectContainer instance. (To add a child to a specific index position, use the addChildAt() method.)

If you add a child object that already has a different display object container as a parent, the object is removed from the child list of the other display object container.

Parameters
child:DisplayObject — The DisplayObject instance to add as a child of this DisplayObjectContainer instance.

Returns
DisplayObject — The DisplayObject instance that you pass in the child parameter.

Events
added:Event — Dispatched when a display object is added to the display list.

Throws
ArgumentError — Throws if the child is the same as the parent. Also throws if the caller is a child (or grandchild etc.) of the child being added.

No comments:

Post a Comment