Packagecom.gestureworks.cml.layouts
Classpublic class GridLayout
InheritanceGridLayout Inheritance Layout Inheritance CMLObject Inheritance flash.events.EventDispatcher

The GridLayout positions the display objects in a grid.
        
        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

FanLayout
ListLayout
PileLayout
PointLayout
RandomLayout
com.gestureworks.cml.layouts.Layout
    


Public Properties
 PropertyDefined By
 Inheritedalpha : Number
Specifies the alpha value of the display objects in the layout
Layout
 InheritedcacheTransforms : Boolean
Flag indicating the childTransformations are to be cached and reapplied for convenience.
Layout
 InheritedcenterColumn : Boolean
Flag indicating the alignment of the objects' centers with the center of the column.
Layout
 InheritedcenterRow : Boolean
Flag indicating the alignment of the objects' centers with the center of the row.
Layout
 InheritedchildList : ChildList
Returns the object's childList.
CMLObject
 InheritedcmlIndex : int
Returns the index created by the CML parser.
CMLObject
  columns : int
An integer representing the number of columns to be created in the grid
GridLayout
 InheritedcontinuousTransform : Boolean
Flag indicating the application of a transform relative to the current transform.
Layout
 Inheritedeasing : *
Specifies the easing equation.
Layout
 Inheritedexclusions : Array
An array of objects to exclude from the layout application
Layout
 Inheritedid : String
Returns the object's id.
CMLObject
  leftToRight : Boolean
An optional boolean that creates the grid from left-to-right or top-to-bottom
GridLayout
 InheritedmarginX : Number
Layout
 InheritedmarginY : Number
Spacing added to the height of an object
Layout
 InheritedonComplete : Function
Function to call on layout complete
Layout
 InheritedonCompleteParams : Array
Parameters for onComplete function
Layout
 InheritedonUpdate : Function
Function to call on layout update
Layout
 InheritedonUpdateParams : Array
Parameters for onUpdate function
Layout
 InheritedoriginX : Number
Starting x coordinate of layout relative to the container
Layout
 Inherited_originY : Number = 0
Layout
 InheritedoriginY : Number
Starting y coordinate of layout relative to the container
Layout
 Inheritedrotation : Number
Specifies the rotation value of the display objects in the layout
Layout
  rows : int
An integer representing the number of rows to be created in the grid
GridLayout
 Inheritedscale : Number
Specifies the scale value of the display objects in the layout
Layout
 InheritedspacingX : Number
Horizontal distance between the origins of two objects
Layout
 InheritedspacingY : Number
Vertical distance between the origins of two objects
Layout
 Inheritedstate : Array
CMLObject
 Inheritedtween : Boolean
Flag indicating the display objects will animate to their layout positions.
Layout
 InheritedtweenTime : Number
The time(ms) the display objects will take to move into positions
Layout
 Inheritedtype : String
Specifies a layout subtype
Layout
 InheriteduseMargins : Boolean
Flag indicating the use of margins or spacing
Layout
Protected Properties
 PropertyDefined By
 InheritedchildTransformations : Array
Layout
Public Methods
 MethodDefined By
  
Constructor
GridLayout
 Inherited
clone():*
Clone method.
CMLObject
  
dispose():void
[override] dispose function
GridLayout
 Inherited
init():void
Initialization method.
CMLObject
 Inherited
killTween(child:* = null):void
Kills the tweening of the provided child.
Layout
  
layout(container:DisplayObjectContainer):void
[override] Apply grid layout to container object Object passed must implement DisplayObjectContainer
GridLayout
 Inherited
parseCML(cml:XMLList):XMLList
Internal CML parse method.
CMLObject
 Inherited
postparseCML(cml:XMLList):void
Abstract method allows the setting of a postparse CML routine.
CMLObject
 Inherited
updateProperties(state:* = 0):void
Updates properties from state.
CMLObject
Protected Methods
 MethodDefined By
 Inherited
degreesToRadians(degrees:Number):Number
[static] Converts degrees to radians
Layout
 Inherited
getMatrixObj(mtx:Matrix):Object
[static] Converts transformation matrix to TweenMax syntax
Layout
 Inherited
getMaxHeight(c:DisplayObjectContainer):Number
[static] Returns the max height of the container's children
Layout
 Inherited
getMaxWidth(c:DisplayObjectContainer):Number
[static] Returns the max width of the container's children
Layout
 Inherited
pointRotateMatrix(angle:Number, aroundX:Number, aroundY:Number, m:Matrix = null):Matrix
[static] Returns a matrix rotated around a specific point at a specific angle
Layout
 Inherited
randomMinMax(min:Number, max:Number):Number
[static] Generates a reandom number between min and max
Layout
 Inherited
rotateAroundPoint(obj:*, angle:Number, aroundX:Number, aroundY:Number):void
[static] Rotates an object around a spcecific point at a specific angle of rotation
Layout
 Inherited
rotateTransform(m:Matrix, rot:Number):void
Apply a rotation to the provided transformation matrix
Layout
 Inherited
scaleTransform(m:Matrix, s:Number):void
Apply a scale to the provided transformation matrix
Layout
 Inherited
translateTransform(m:Matrix, x:Number, y:Number):void
Apply a translation to the provided transformation matrix
Layout
 Inherited
validObject(obj:*):Boolean
Determines if an object meets the criteria to be included in the layout
Layout
Property Detail
columnsproperty
columns:int

An integer representing the number of columns to be created in the grid

The default value is 2.


Implementation
    public function get columns():int
    public function set columns(value:int):void
leftToRightproperty 
leftToRight:Boolean

An optional boolean that creates the grid from left-to-right or top-to-bottom

The default value is true.


Implementation
    public function get leftToRight():Boolean
    public function set leftToRight(value:Boolean):void
rowsproperty 
rows:int

An integer representing the number of rows to be created in the grid

The default value is 1.


Implementation
    public function get rows():int
    public function set rows(value:int):void
Constructor Detail
GridLayout()Constructor
public function GridLayout()

Constructor

Method Detail
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