| Package | lunas.containers |
| Class | public class Container |
| Inheritance | Container CoreComponent Background CoreSprite flash.display.Sprite |
| Implements | IContainer |
| Subclasses | CircleContainer, ListContainer |
Example :
import flash.display.StageScaleMode ;
import flash.events.KeyboardEvent ;
import flash.text.TextFieldAutoSize ;
import flash.text.TextFormat ;
import lunas.containers.Container ;
stage.scaleMode = StageScaleMode.NO_SCALE ;
var container:Container = new Container() ;
container.x = 25 ;
container.y = 25 ;
addChild(container) ;
for (var i:uint = 0 ; i < 10 ; i++ )
{
var field:TextField = new TextField() ;
field.x = 10 ;
field.y = 10 ;
field.autoSize = TextFieldAutoSize.LEFT ;
field.defaultTextFormat = new TextFormat("verdana", 10) ;
field.text = "#" + i ;
var display:Square = new Square() ; // linked Sprite in the library of the swf.
container.addChild( display ) ;
display.x = i * ( display.width + 10 ) ;
display.addChild( field ) ;
}
var keyDown:Function = function( e:KeyboardEvent ):void
{
// trace( "removeChildsAt(2,3) : " + container.removeChildsAt(2,3) ) ;
trace( "removeRange(2,3) : " + container.removeRange(2,5) ) ;
}
stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
| Property | Defined By | ||
|---|---|---|---|
![]() | align : uint
The alignement of the background. | Background | |
![]() | autoSize : Boolean
Indicates if the background is resizing when the stage resize event is invoked. | Background | |
![]() | border : EdgeMetrics
Indicates the thickness, in pixels, of the four edge regions around a visual component. | CoreComponent | |
![]() | bottomLeftRadius : Number
The radius of the bottom-left corner, in pixels. | Background | |
![]() | bottomRightRadius : Number
The radius of the bottom-right corner, in pixels. | Background | |
![]() | bubbles : Boolean = true
Indicates if the events use bubbling when are dispatched. | CoreComponent | |
![]() | builder : Builder
Indicates the Builder reference of this instance. | CoreComponent | |
![]() | componentInspectorSetting : Boolean
Initialize when the Flash component settings are initialized (only in Flash with a compiled component). | CoreComponent | |
![]() | direction : String
Indicates the direction value of the background when the display is in this "full" mode (default value is null). | Background | |
![]() | enabled : Boolean
Indicates the enabled state of the component. | CoreComponent | |
![]() | fill : IFillStyle
Determinates the IFillStyle reference of this display. | Background | |
![]() | gradientMatrix : Matrix
The matrix value to draw the gradient fill. | Background | |
![]() | gradientRotation : Number = 0
The rotation value to draw the gradient fill. | Background | |
![]() | gradientTranslation : Point
The translation vector to draw the gradient fill. | Background | |
![]() | group : Boolean
Indicates with a boolean if this object is grouped. | CoreComponent | |
![]() | groupName : String
Indicates the name of the group of this object. | CoreComponent | |
![]() | h : Number
Determinates the virtual height value of this component. | Background | |
| invert : Boolean
Inverts the z-depth of the childs in the container. | Container | ||
![]() | isFull : Boolean
Indicates if the background use full size (use Stage.stageWidth and Stage.stageHeight to resize the background). | Background | |
![]() | layout : Layout
Determinates the layout of this container. | CoreComponent | |
![]() | line : ILineStyle
Determinates the ILineStyle reference of this display. | Background | |
![]() | logger : Logger
Determinates the internal ILogger reference of this Logable object. | CoreSprite | |
![]() | maxHeight : Number
This property defined the maximum height of this display. | Background | |
![]() | maxWidth : Number
Defines the maximum width of this display. | Background | |
![]() | minHeight : Number
This property defined the mimimun height of this display (This value is >= 0). | Background | |
![]() | minWidth : Number
This property defined the mimimun width of this display (This value is >= 0). | Background | |
| numChildren : int [override] [read-only]
Determinates the number of children of this object. | Container | ||
![]() | style : Style
Returns the style of this component. | CoreComponent | |
![]() | topLeftRadius : Number
The radius of the upper-left corner, in pixels. | Background | |
![]() | topRightRadius : Number
The radius of the upper-right corner, in pixels. | Background | |
![]() | useGradientBox : Boolean
Indicates if the IFillStyle of this display use gradient box matrix (only if the IFillStyle is a FillGradientStyle). | Background | |
![]() | w : Number
Determinates the virtual height value of this component. | Background | |
| Method | Defined By | ||
|---|---|---|---|
Creates a new Container instance. | Container | ||
addChild(child:DisplayObject):DisplayObject [override]
Adds a child DisplayObject instance to this DisplayObjectContainer instance. | Container | ||
addChildAt(child:DisplayObject, index:int):DisplayObject [override]
Adds a child DisplayObject instance to this DisplayObjectContainer instance. | Container | ||
areInaccessibleObjectsUnderPoint(point:Point):Boolean [override]
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. | Container | ||
clear():void
Removes all childs in the container. | Container | ||
contains(child:DisplayObject):Boolean [override]
Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance itself. | Container | ||
containsAt(index:int):Boolean
Returns true if a child exist in the display list at the specified index value. | Container | ||
![]() | doLater():void
Launch an event with a delayed interval. | Background | |
![]() | draw(... arguments):void
Draw the display. | Background | |
![]() | getBuilderRenderer():Class
Returns the Builder constructor use to initialize this component. | CoreComponent | |
getChildAt(index:int):DisplayObject [override]
Returns the child display object instance that exists at the specified index. | Container | ||
getChildByName(name:String):DisplayObject [override]
Returns the child display object that exists with the specified name. | Container | ||
getChildIndex(child:DisplayObject):int [override]
Returns the index position of a child DisplayObject instance. | Container | ||
getObjectsUnderPoint(point:Point):Array [override]
Returns an array of objects that lie under the specified point and are children (or grandchildren, and so on) of this DisplayObjectContainer instance. | Container | ||
![]() | getStyleRenderer():Class
Returns the Style constructor use to initialize this component. | CoreComponent | |
![]() | groupPolicyChanged():void
Invoked when the group property or the groupName property changed. | CoreComponent | |
![]() | hide():void
Hides the component. | CoreComponent | |
![]() | initBackgroundPen(graphic:* = null):IPen
Init the pen to draw the background of this display. | Background | |
![]() | initialize():void
Initialize the component. | CoreComponent | |
![]() | isLocked():Boolean
Returns true if the object is locked. | CoreSprite | |
![]() | isVisible():Boolean
Returns true if the component is visible. | CoreComponent | |
![]() | lock():void [override]
Locks the object. | CoreComponent | |
![]() | move(x:Number, y:Number):void
Moves the component. | CoreComponent | |
![]() | notifyChanged():void
Notify a change in this component. | CoreComponent | |
![]() | notifyEnabled():void
Notify an event when the enabled property is changed. | CoreComponent | |
![]() | notifyResized():void
Notify an event when you resize the component. | Background | |
![]() | refresh(init:*):void
Refresh and initialize the display with a generic object and invoke the "update" method. | Background | |
![]() | registerView(scope:DisplayObjectContainer = null):void
Registers the view of this component. | CoreComponent | |
removeChild(child:DisplayObject):DisplayObject [override]
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance. | Container | ||
removeChildAt(index:int):DisplayObject [override]
Removes a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer. | Container | ||
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. | Container | ||
removeRange(from:int, to:int):Array
Removes a range of childs in the container. | Container | ||
![]() | resetLock():void
Reset the lock security of the display. | CoreSprite | |
![]() | resize(e:Event = null):void
Resize and update the background. | Background | |
![]() | scope():DisplayObject
Returns the real scope reference of this component. | CoreComponent | |
setChildIndex(child:DisplayObject, index:int):void [override]
Changes the position of an existing child in the display object container. | Container | ||
![]() | setCornerRadius(n:Number):void
Defines all corner radius of the background (upper-left, upper-right, bottom-left and bottom-right). | Background | |
![]() | setSize(w:Number, h:Number):void
Sets the virtual width (w) and height (h) values of the component. | Background | |
![]() | setStyle(... args):void
Sets the style property on the style declaration or object. | CoreComponent | |
![]() | show():void
Shows the component. | CoreComponent | |
swapChildren(child1:DisplayObject, child2:DisplayObject):void [override]
Swaps the z-order (front-to-back order) of the two specified child objects. | Container | ||
swapChildrenAt(index1:int, index2:int):void [override]
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child list. | Container | ||
toArray():Array
Returns the Array representation of all childs in this container. | Container | ||
![]() | unlock():void [override]
Unlocks the display. | CoreComponent | |
![]() | unregisterView():void
Unregisters the view of this component. | CoreComponent | |
![]() | update():void [override]
Updates the component. | CoreComponent | |
![]() | viewChanged():void
This method is invoked after the draw() method in the update() method. | Background | |
![]() | viewDestroyed(e:Event = null):void
Invoked when the component is removed. | CoreComponent | |
![]() | viewEnabled():void
Invoked when the enabled property of the component change. | Background | |
![]() | viewResize():void
Invoked when the component is resized. | Background | |
![]() | viewStyleChanged(e:Event = null):void
Invoked when the component Style changed. | CoreComponent | |
| invert | property |
invert:BooleanInverts the z-depth of the childs in the container.
public function get invert():Boolean public function set invert(value:Boolean):void| numChildren | property |
numChildren:int [read-only] [override] Determinates the number of children of this object.
public function get numChildren():int| Container | () | Constructor |
public function Container()Creates a new Container instance.
| addChild | () | method |
override public function addChild(child:DisplayObject):DisplayObjectAdds 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.
|
DisplayObject — The DisplayObject instance that you pass in the child parameter.
|
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 |
override public function addChildAt(child:DisplayObject, index:int):DisplayObjectAdds 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.
|
DisplayObject — The DisplayObject instance that you pass in the child parameter.
|
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 |
override public function areInaccessibleObjectsUnderPoint(point:Point):BooleanIndicates 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.
|
Boolean — true if the point contains child display objects with security restrictions.
|
| clear | () | method |
public function clear():voidRemoves all childs in the container.
| contains | () | method |
override public function contains(child:DisplayObject):BooleanDetermines 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.
|
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 |
Boolean — true if a child exist in the display list at the specified index value.
|
| getChildAt | () | method |
override public function getChildAt(index:int):DisplayObjectReturns the child display object instance that exists at the specified index.
Parameters
index:int — The index position of the child object.
|
DisplayObject — The child display object at the specified index position.
|
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 | () | method |
override public function getChildByName(name:String):DisplayObjectReturns 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.
|
DisplayObject — The child display object with the specified name.
|
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 |
override public function getChildIndex(child:DisplayObject):intReturns the index position of a child DisplayObject instance.
Parameters
child:DisplayObject — The DisplayObject instance to identify.
|
int — The index position of the child display object to identify.
|
| getObjectsUnderPoint | () | method |
override public function getObjectsUnderPoint(point:Point):ArrayReturns 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.
|
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 |
override public function removeChild(child:DisplayObject):DisplayObjectRemoves 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.
|
DisplayObject — The DisplayObject instance that you pass in the child parameter.
|
ArgumentError — Throws if the child parameter is not a child of this object.
|
| removeChildAt | () | method |
override public function removeChildAt(index:int):DisplayObjectRemoves 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.
|
DisplayObject — The DisplayObject instance that was removed.
|
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 |
Array |
RangeError — if the index value is out of the bounds of the container elements.
|
| removeRange | () | method |
public function removeRange(from:int, to:int):ArrayRemoves a range of childs in the container.
Parameters
from:int | |
to:int |
Array — the array representation of all removed items.
|
RangeError — if the index value is out of the bounds of the container elements.
|
| setChildIndex | () | method |
override public function setChildIndex(child:DisplayObject, index:int):voidChanges 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.
|
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 |
override public function swapChildren(child1:DisplayObject, child2:DisplayObject):voidSwaps 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.
|
ArgumentError — Throws if either child parameter is not a child of this object.
|
| swapChildrenAt | () | method |
override public function swapChildrenAt(index1:int, index2:int):voidSwaps 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.
|
RangeError — — If either index does not exist in the child list.
|
| toArray | () | method |
public function toArray():ArrayReturns the Array representation of all childs in this container.
ReturnsArray — the Array representation of all childs in this container.
|