Packagelunas
Interfacepublic interface IContainer
Implementors Container

This interface defines all method of the Container components.



Public Properties
 PropertyDefined By
  numChildren : int
[read-only] Indicates the number of children of this object.
IContainer
Public Methods
 MethodDefined By
  
addChild(child:DisplayObject):DisplayObject
Adds a child DisplayObject instance to this DisplayObjectContainer instance.
IContainer
  
addChildAt(child:DisplayObject, index:int):DisplayObject
Adds a child DisplayObject instance to this DisplayObjectContainer instance.
IContainer
  
Indicates whether the security restrictions would cause any display objects to be omitted from the list returned by calling the DisplayObjectContainer.getObjectsUnderPoint() method with the specified point point.
IContainer
  
contains(child:DisplayObject):Boolean
Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance itself.
IContainer
  
containsAt(index:int):Boolean
Returns true if a child exist in the display list at the specified index value.
IContainer
  
getChildAt(index:int):DisplayObject
Returns the child display object instance that exists at the specified index.
IContainer
  
getChildByName(name:String):DisplayObject
Returns the child display object that exists with the specified name.
IContainer
  
getChildIndex(child:DisplayObject):int
Returns the index position of a child DisplayObject instance.
IContainer
  
getObjectsUnderPoint(point:Point):Array
Returns an array of objects that lie under the specified point and are children (or grandchildren, and so on) of this DisplayObjectContainer instance.
IContainer
  
removeChild(child:DisplayObject):DisplayObject
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance.
IContainer
  
removeChildAt(index:int):DisplayObject
Removes a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer.
IContainer
  
removeChildsAt(index:int, size:Number):Array
Removes all childs in the model defined for the first item by the specified index value, this method remove the first and the size - 1 items.
IContainer
  
removeRange(from:int, to:int):Array
Removes a range of childs in the container.
IContainer
  
setChildIndex(child:DisplayObject, index:int):void
Changes the position of an existing child in the display object container.
IContainer
  
swapChildren(child1:DisplayObject, child2:DisplayObject):void
Swaps the z-order (front-to-back order) of the two specified child objects.
IContainer
  
swapChildrenAt(index1:int, index2:int):void
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child list.
IContainer
Property Detail
numChildrenproperty
numChildren:int  [read-only]

Indicates the number of children of this object.


Implementation
    public function get numChildren():int
Method Detail
addChild()method
public function addChild(child:DisplayObject):DisplayObject

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.

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.
addChildAt()method 
public function addChildAt(child:DisplayObject, index:int):DisplayObject

Adds a child DisplayObject instance to this DisplayObjectContainer instance. The child is added at the index position specified. An index of 0 represents the back (bottom) of the display list for this DisplayObjectContainer object.

Parameters

child:DisplayObject — The DisplayObject instance to add as a child of this DisplayObjectContainer instance.
 
index:int — The index position to which the child is added. If you specify a currently occupied index position, the child object that exists at that position and all higher positions are moved up one position in the child list.

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

Throws
RangeError — Throws if the index position does not exist in the child list.
 
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.
areInaccessibleObjectsUnderPoint()method 
public function areInaccessibleObjectsUnderPoint(point:Point):Boolean

Indicates whether the security restrictions would cause any display objects to be omitted from the list returned by calling the DisplayObjectContainer.getObjectsUnderPoint() method with the specified point point. By default, content from one domain cannot access objects from another domain unless they are permitted to do so with a call to the Security.allowDomain() method.

Parameters

point:Point — The point under which to look.

Returns
Boolean — true if the point contains child display objects with security restrictions.
contains()method 
public function contains(child:DisplayObject):Boolean

Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance itself. The search includes the entire display list including this DisplayObjectContainer instance. Grandchildren, great-grandchildren, and so on each return true.

Parameters

child:DisplayObject — The child object to test.

Returns
Boolean — true if the child object is a child of the DisplayObjectContainer or the container itself; otherwise false.
containsAt()method 
public function containsAt(index:int):Boolean

Returns true if a child exist in the display list at the specified index value.

Parameters

index:int

Returns
Booleantrue if a child exist in the display list at the specified index value.
getChildAt()method 
public function getChildAt(index:int):DisplayObject

Returns the child display object instance that exists at the specified index.

Parameters

index:int — The index position of the child object.

Returns
DisplayObject — The child display object at the specified index position.

Throws
RangeError — Throws if the index does not exist in the child list.
 
SecurityError — This child display object belongs to a sandbox to which you do not have access. You can avoid this situation by having the child movie call Security.allowDomain().

See also

getChildByName()
getChildByName()method 
public function getChildByName(name:String):DisplayObject

Returns the child display object that exists with the specified name. If more that one child display object has the specified name, the method returns the first object in the child list.

Parameters

name:String — The name of the child to return.

Returns
DisplayObject — The child display object with the specified name.

Throws
SecurityError — This child display object belongs to a sandbox to which you do not have access. You can avoid this situation by having the child movie call the Security.allowDomain() method.
getChildIndex()method 
public function getChildIndex(child:DisplayObject):int

Returns the index position of a child DisplayObject instance.

Parameters

child:DisplayObject — The DisplayObject instance to identify.

Returns
int — The index position of the child display object to identify.
getObjectsUnderPoint()method 
public function getObjectsUnderPoint(point:Point):Array

Returns an array of objects that lie under the specified point and are children (or grandchildren, and so on) of this DisplayObjectContainer instance. Any child objects that are inaccessible for security reasons are omitted from the returned array. To determine whether this security restriction affects the returned array, call the areInaccessibleObjectsUnderPoint() method.

Parameters

point:Point — point under which to look.

Returns
Array — An array of objects that lie under the specified point and are children (or grandchildren, and so on) of this DisplayObjectContainer instance.
removeChild()method 
public function removeChild(child:DisplayObject):DisplayObject

Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance. The parent property of the removed child is set to null , and the object is garbage collected if no other references to the child exist. The index positions of any display objects above the child in the DisplayObjectContainer are decreased by 1.

Parameters

child:DisplayObject — The DisplayObject instance to remove.

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

Throws
ArgumentError — Throws if the child parameter is not a child of this object.
removeChildAt()method 
public function removeChildAt(index:int):DisplayObject

Removes a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer. The parent property of the removed child is set to null, and the object is garbage collected if no other references to the child exist. The index positions of any display objects above the child in the DisplayObjectContainer are decreased by 1.

Parameters

index:int — The child index of the DisplayObject to remove.

Returns
DisplayObject — The DisplayObject instance that was removed.

Throws
RangeError — Throws if the index does not exist in the child list.
 
SecurityError — This child display object belongs to a sandbox to which the calling object does not have access. You can avoid this situation by having the child movie call the Security.allowDomain() method.
removeChildsAt()method 
public function removeChildsAt(index:int, size:Number):Array

Removes all childs in the model defined for the first item by the specified index value, this method remove the first and the size - 1 items.

Parameters

index:int
 
size:Number

Returns
Array

Throws
RangeError — if the index value is out of the bounds of the container elements.
removeRange()method 
public function removeRange(from:int, to:int):Array

Removes a range of childs in the container.

Parameters

from:int
 
to:int

Returns
Array — the array representation of all removed items.

Throws
RangeError — if the index value is out of the bounds of the container elements.
setChildIndex()method 
public function setChildIndex(child:DisplayObject, index:int):void

Changes the position of an existing child in the display object container. This affects the layering of child objects.

Parameters

child:DisplayObject — The child DisplayObject instance for which you want to change the index number.
 
index:int — The resulting index number for the child display object.


Throws
RangeError — Throws if the index does not exist in the child list.
 
ArgumentError — Throws if the child parameter is not a child of this object.
swapChildren()method 
public function swapChildren(child1:DisplayObject, child2:DisplayObject):void

Swaps the z-order (front-to-back order) of the two specified child objects. All other child objects in the display object container remain in the same index positions.

Parameters

child1:DisplayObject — The first child object.
 
child2:DisplayObject — The second child object.


Throws
ArgumentError — Throws if either child parameter is not a child of this object.
swapChildrenAt()method 
public function swapChildrenAt(index1:int, index2:int):void

Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child list. All other child objects in the display object container remain in the same index positions.

Parameters

index1:int — The index position of the first child object.
 
index2:int — The index position of the second child object.


Throws
RangeError — — If either index does not exist in the child list.