Container


Inheritance Container View Module hilo/view/Container Requires hilo/core/Hilo, hilo/core/Class, hilo/view/View Source Container.js
Container is the base class to all container classes. Each Container can add other view object as children.

Properties

Show Inherited Properties
Property Defined
children:Array
List of children elements of the container, readonly!
Container
clipChildren:Boolean
Whether clip children elements which are out of the container, default value is false.
Container
pointerChildren:Boolean
Whether children elements of the container can response to user interactive events, default value is true.
Container

Methods

Show Inherited Methods
Method Defined
Container(properties:Object)
Constructor
Container
addChild(child:View)
Add child element at the top.
Container
addChildAt(child:View, index:Number)
Add child element at given index.
Container
contains(child:View)
Return whether this container contains the parameter described child element.
Container
getChildAt(index:Number)
Return child element at the given index.
Container
getChildById(id:String)
Return child element at the given id.
Container
Return index value of the given child element.
Container
Return the amount of the children elements of the container.
Container
getViewAtPoint(x:Number, y:Number, usePolyCollision:Boolean, global:Boolean, eventMode:Boolean)
Return object at the point positioned by given values on x axis and y axis.
Container
removeAllChildren():Container
Remove all children elements.
Container
removeChild(child:View):View
Remove the given child element.
Container
removeChildAt(index:Int):View
Remove element at the index.
Container
removeChildById(id:String):View
Remove child element by its id.
Container
setChildIndex(child:View, index:Number)
Set the index of child element.
Container
sortChildren(keyOrFunction:Object)
Sort children elements by the given key or function.
Container
swapChildren(child1:View, child2:View)
Swap index between two child elements.
Container
swapChildrenAt(index1:Number, index2:Number)
Swap two children elements at given indexes.
Container

Property Detail

children:Array
List of children elements of the container, readonly!
clipChildren:Boolean
Whether clip children elements which are out of the container, default value is false.
pointerChildren:Boolean
Whether children elements of the container can response to user interactive events, default value is true.

Constructor

Container(properties:Object)
parameters
properties:Object — Properties parameters of the object to create. Contains all writable properties of this class.

Method Detail

addChild(child:View)
Add child element at the top.
parameters
child:View — Elements to add.
addChildAt(child:View, index:Number)
Add child element at given index.
parameters
child:View — Element to add.
index:Number — The given index position, range from 0.
contains(child:View)
Return whether this container contains the parameter described child element.
parameters
child:View — The child element to test.
getChildAt(index:Number)
Return child element at the given index.
parameters
index:Number — The index of the element, range from 0.
getChildById(id:String)
Return child element at the given id.
parameters
id:String — The id of child element to return.
getChildIndex(child:View)
Return index value of the given child element.
parameters
child:View — The child element need to get its index.
getNumChildren():Uint
Return the amount of the children elements of the container.
return
Uint — The amount of the children elements of the container.
getViewAtPoint(x:Number, y:Number, usePolyCollision:Boolean, global:Boolean, eventMode:Boolean)
Return object at the point positioned by given values on x axis and y axis.
parameters
x:Number — The point's value on the coordinate's x axis.
y:Number — The point's value on the coordinate's y asix.
usePolyCollision:Boolean — Whether use polygon collision detection, default value is false.
global:Boolean — Whether return all elements that match the condition, default value is false.
eventMode:Boolean — Whether find elements under event mode, default value is false.
removeAllChildren():Container
Remove all children elements.
return
Container — Container itself.
removeChild(child:View):View
Remove the given child element.
parameters
child:View — The child element to remove.
return
View — Element had been removed.
removeChildAt(index:Int):View
Remove element at the index.
parameters
index:Int — Index of the element to remove, range from 0.
return
View — Element had been removed.
removeChildById(id:String):View
Remove child element by its id.
parameters
id:String — The id of element to remove.
return
View — Element had been removed.
setChildIndex(child:View, index:Number)
Set the index of child element.
parameters
child:View — The child element need to set index.
index:Number — The index to set to the element.
sortChildren(keyOrFunction:Object)
Sort children elements by the given key or function.
parameters
keyOrFunction:Object — If is String, sort children elements by the given property string; If is Function, sort by the function.
swapChildren(child1:View, child2:View)
Swap index between two child elements.
parameters
child1:View — Child element A.
child2:View — Child element B.
swapChildrenAt(index1:Number, index2:Number)
Swap two children elements at given indexes.
parameters
index1:Number — Given index A.
index2:Number — Given index B.