- override
Adds a child DisplayObject to this DisplayObjectContainer.
The child is added to the front (top) of all other children. (To add a child to a specific index position, use addChildAt.)
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.
Source
@override void addChild(DisplayObject child) { if (child == this) { throw new ArgumentError("An object cannot be added as a child of itself."); } else if (child.parent == this) { _addLocalChild(child); } else { child.removeFromParent(); _throwIfAncestors(child); _children.add(child); _setChildParent(child); } }