Package | com.gestureworks.cml.layouts |
Class | public class GridLayout |
Inheritance | GridLayout ![]() ![]() ![]() |
var grid:Container = getImageContainer(); grid.applyLayout(getGridLayout()); addChild(grid); function getImageContainer():Container { var container:Container = new Container(); container.addChild(getImageElement("plane.jpg)); container.addChild(getImageElement("plane.jpg)); container.addChild(getImageElement("plane.jpg)); container.addChild(getImageElement("plane.jpg)); container.addChild(getImageElement("plane.jpg)); container.addChild(getImageElement("plane.jpg)); container.addChild(getImageElement("plane.jpg)); container.addChild(getImageElement("plane.jpg)); return container; } function getGridLayout():GridLayout { var gridLayout:GridLayout = new GridLayout(); gridLayout.rows = 3; gridLayout.columns = 3; gridLayout.useMargins = true; gridLayout.marginX = 4; gridLayout.marginY = 4; gridLayout.tween = true; gridLayout.tweenTime = 1500; return gridLayout; } function getImageElement(source:String):Image { var img:Image = new Image(); img.open(source); img.width = 250; img.height = 150; img.resample = true; return img; }
See also
Property | Defined By | ||
---|---|---|---|
![]() | alpha : Number
Specifies the alpha value of the display objects in the layout
| LayoutFactory | |
![]() | cacheTransforms : Boolean
Flag indicating the childTransformations are to be cached and reapplied for convenience. | LayoutFactory | |
![]() | centerColumn : Boolean
Flag indicating the alignment of the objects' centers with the center of the column. | LayoutFactory | |
![]() | centerRow : Boolean
Flag indicating the alignment of the objects' centers with the center of the row. | LayoutFactory | |
![]() | cmlIndex : int
sets the index of cml
| ObjectFactory | |
columns : int
An integer representing the number of columns to be created in the grid
| GridLayout | ||
![]() | continuousTransform : Boolean
Flag indicating the application of a transform relative to the current transform. | LayoutFactory | |
![]() | easing : *
Specifies the easing equation. | LayoutFactory | |
![]() | exclusions : Array
An array of objects to exclude from the layout application
| LayoutFactory | |
![]() | id : String
sets the id
| ObjectFactory | |
leftToRight : Boolean
An optional boolean that creates the grid from left-to-right or top-to-bottom
| GridLayout | ||
![]() | marginX : Number | LayoutFactory | |
![]() | marginY : Number
Spacing added to the height of an object
| LayoutFactory | |
![]() | onComplete : Function
Function to call on layout complete
| LayoutFactory | |
![]() | onUpdate : Function
Function to call on layout update
| LayoutFactory | |
![]() | originX : Number
Starting x coordinate of layout relative to the container
| LayoutFactory | |
![]() | _originY : Number = 0 | LayoutFactory | |
![]() | originY : Number
Starting y coordinate of layout relative to the container
| LayoutFactory | |
![]() | propertyStates : Array Deprecated: Please Use state | ObjectFactory | |
![]() | rotation : Number
Specifies the rotation value of the display objects in the layout
| LayoutFactory | |
rows : int
An integer representing the number of rows to be created in the grid
| GridLayout | ||
![]() | scale : Number
Specifies the scale value of the display objects in the layout
| LayoutFactory | |
![]() | spacingX : Number
Horizontal distance between the origins of two objects
| LayoutFactory | |
![]() | spacingY : Number
Vertical distance between the origins of two objects
| LayoutFactory | |
![]() | state : Array
property states array
| ObjectFactory | |
![]() | tween : Boolean
Flag indicating the display objects will animate to their layout positions. | LayoutFactory | |
![]() | tweenTime : Number
The time(ms) the display objects will take to move into positions
| LayoutFactory | |
![]() | type : String
Specifies a layout subtype
| LayoutFactory | |
![]() | useMargins : Boolean
Flag indicating the use of margins or spacing
| LayoutFactory |
Method | Defined By | ||
---|---|---|---|
Constructor
| GridLayout | ||
![]() | clone():*
Returns clone of self
| ObjectFactory | |
dispose():void [override]
dispose function
| GridLayout | ||
![]() | killTween(child:* = null):void
Kills the tweening of the provided child. | LayoutFactory | |
layout(container:DisplayObjectContainer):void [override]
Apply grid layout to container object
Object passed must implement DisplayObjectContainer
| GridLayout | ||
![]() | parseCML(cml:XMLList):XMLList
parses cml file
| ObjectFactory | |
![]() | postparseCML(cml:XMLList):void
postparse method
| ObjectFactory | |
![]() | updateProperties(state:Number = 0):void
update the properties
| ObjectFactory |
columns | property |
columns:int
An integer representing the number of columns to be created in the grid
The default value is 2
.
public function get columns():int
public function set columns(value:int):void
leftToRight | property |
leftToRight:Boolean
An optional boolean that creates the grid from left-to-right or top-to-bottom
The default value is true
.
public function get leftToRight():Boolean
public function set leftToRight(value:Boolean):void
rows | property |
rows:int
An integer representing the number of rows to be created in the grid
The default value is 1
.
public function get rows():int
public function set rows(value:int):void
GridLayout | () | Constructor |
public function GridLayout()
Constructor
dispose | () | method |
override public function dispose():void
dispose function
layout | () | method |
override public function layout(container:DisplayObjectContainer):void
Apply grid layout to container object Object passed must implement DisplayObjectContainer
Parameters
container:DisplayObjectContainer |