Packagecom.gestureworks.cml.factories
Classpublic class LayoutFactory
InheritanceLayoutFactory Inheritance ObjectFactory Inheritance flash.events.EventDispatcher
Implements ILayout
Subclasses FanLayout, GridLayout, ListLayout, PileLayout, PointLayout, RandomLayout

The LayoutFactory is the base class for all Layouts. It is an abstract class that is not meant to be called directly.

See also

com.gestureworks.cml.factories.Container
com.gestureworks.cml.factories.TouchContainer
com.gestureworks.cml.factories.ElementFactory
com.gestureworks.cml.factories.ObjectFactory


Public Properties
 PropertyDefined 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
 InheritedcmlIndex : int
sets the index of cml
ObjectFactory
  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
 Inheritedid : String
sets the id
ObjectFactory
  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
 InheritedpropertyStates : Array
Deprecated: Please Use state
ObjectFactory
  rotation : Number
Specifies the rotation value of the display objects in the layout
LayoutFactory
  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
 Inheritedstate : 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
Protected Properties
 PropertyDefined By
  childTransformations : Array
LayoutFactory
Public Methods
 MethodDefined By
  
Constructor
LayoutFactory
 Inherited
clone():*
Returns clone of self
ObjectFactory
  
dispose():void
[override] Destructor
LayoutFactory
  
killTween(child:* = null):void
Kills the tweening of the provided child.
LayoutFactory
  
layout(container:DisplayObjectContainer):void
The object distribution function.
LayoutFactory
 Inherited
parseCML(cml:XMLList):XMLList
parses cml file
ObjectFactory
 Inherited
postparseCML(cml:XMLList):void
postparse method
ObjectFactory
 Inherited
updateProperties(state:Number = 0):void
update the properties
ObjectFactory
Protected Methods
 MethodDefined By
  
degreesToRadians(degrees:Number):Number
[static] Converts degrees to radians
LayoutFactory
  
getMatrixObj(mtx:Matrix):Object
[static] Converts transformation matrix to TweenMax syntax
LayoutFactory
  
getMaxHeight(c:DisplayObjectContainer):Number
[static] Returns the max height of the container's children
LayoutFactory
  
getMaxWidth(c:DisplayObjectContainer):Number
[static] Returns the max width of the container's children
LayoutFactory
  
pointRotateMatrix(angle:Number, aroundX:Number, aroundY:Number, m:Matrix = null):Matrix
[static] Returns a matrix rotated around a specific point at a specific angle
LayoutFactory
  
randomMinMax(min:Number, max:Number):Number
[static] Generates a reandom number between min and max
LayoutFactory
  
rotateAroundPoint(obj:*, angle:Number, aroundX:Number, aroundY:Number):void
[static] Rotates an object around a spcecific point at a specific angle of rotation
LayoutFactory
  
rotateTransform(m:Matrix, rot:Number):void
Apply a rotation to the provided transformation matrix
LayoutFactory
  
scaleTransform(m:Matrix, s:Number):void
Apply a scale to the provided transformation matrix
LayoutFactory
  
translateTransform(m:Matrix, x:Number, y:Number):void
Apply a translation to the provided transformation matrix
LayoutFactory
  
validObject(obj:*):Boolean
Determines if an object meets the criteria to be included in the layout
LayoutFactory
Property Detail
_originYproperty
public var _originY:Number = 0

alphaproperty 
alpha:Number

Specifies the alpha value of the display objects in the layout

The default value is 1.


Implementation
    public function get alpha():Number
    public function set alpha(value:Number):void
cacheTransformsproperty 
cacheTransforms:Boolean

Flag indicating the childTransformations are to be cached and reapplied for convenience. If this flag is disabled, the transformations will need to be recreated for each child.

The default value is true.


Implementation
    public function get cacheTransforms():Boolean
    public function set cacheTransforms(value:Boolean):void
centerColumnproperty 
centerColumn:Boolean

Flag indicating the alignment of the objects' centers with the center of the column. Column width is determined by greatest width of the display objects.

The default value is false.


Implementation
    public function get centerColumn():Boolean
    public function set centerColumn(value:Boolean):void
centerRowproperty 
centerRow:Boolean

Flag indicating the alignment of the objects' centers with the center of the row. Row height is determined by greatest height of the display objects.

The default value is false.


Implementation
    public function get centerRow():Boolean
    public function set centerRow(value:Boolean):void
childTransformationsproperty 
protected var childTransformations:Array

continuousTransformproperty 
continuousTransform:Boolean

Flag indicating the application of a transform relative to the current transform. If this flag is turned off, the transformation is reset with the principle layout attributes. (e.g. Given an object with a rotation of 45 degrees, applying a rotation of 10 in continuous mode will set the object's rotation to 55. In non-continuous mode, applying a rotation of 10 degrees will set the object's rotation to 10).

The default value is true;.


Implementation
    public function get continuousTransform():Boolean
    public function set continuousTransform(value:Boolean):void
easingproperty 
easing:*

Specifies the easing equation. Argument must be an Ease instance or a String defining the Ease class either by property syntax or class name (e.g. Expo.easeOut or ExpoOut).


Implementation
    public function get easing():*
    public function set easing(value:any):void
exclusionsproperty 
exclusions:Array

An array of objects to exclude from the layout application


Implementation
    public function get exclusions():Array
    public function set exclusions(value:Array):void
marginXproperty 
marginX:Number


Implementation
    public function get marginX():Number
    public function set marginX(value:Number):void
marginYproperty 
marginY:Number

Spacing added to the height of an object

The default value is 10.


Implementation
    public function get marginY():Number
    public function set marginY(value:Number):void
onCompleteproperty 
onComplete:Function

Function to call on layout complete


Implementation
    public function get onComplete():Function
    public function set onComplete(value:Function):void
onUpdateproperty 
onUpdate:Function

Function to call on layout update


Implementation
    public function get onUpdate():Function
    public function set onUpdate(value:Function):void
originXproperty 
originX:Number

Starting x coordinate of layout relative to the container

The default value is 0.


Implementation
    public function get originX():Number
    public function set originX(value:Number):void
originYproperty 
originY:Number

Starting y coordinate of layout relative to the container

The default value is 0.


Implementation
    public function get originY():Number
    public function set originY(value:Number):void
rotationproperty 
rotation:Number

Specifies the rotation value of the display objects in the layout


Implementation
    public function get rotation():Number
    public function set rotation(value:Number):void
scaleproperty 
scale:Number

Specifies the scale value of the display objects in the layout


Implementation
    public function get scale():Number
    public function set scale(value:Number):void
spacingXproperty 
spacingX:Number

Horizontal distance between the origins of two objects

The default value is 100.


Implementation
    public function get spacingX():Number
    public function set spacingX(value:Number):void
spacingYproperty 
spacingY:Number

Vertical distance between the origins of two objects

The default value is 100.


Implementation
    public function get spacingY():Number
    public function set spacingY(value:Number):void
tweenproperty 
tween:Boolean

Flag indicating the display objects will animate to their layout positions. If false, the objects will be positioned at initialization.

The default value is true.


Implementation
    public function get tween():Boolean
    public function set tween(value:Boolean):void
tweenTimeproperty 
tweenTime:Number

The time(ms) the display objects will take to move into positions

The default value is 500.


Implementation
    public function get tweenTime():Number
    public function set tweenTime(value:Number):void
typeproperty 
type:String

Specifies a layout subtype

The default value is null.


Implementation
    public function get type():String
    public function set type(value:String):void
useMarginsproperty 
useMargins:Boolean

Flag indicating the use of margins or spacing

The default value is false.


Implementation
    public function get useMargins():Boolean
    public function set useMargins(value:Boolean):void
Constructor Detail
LayoutFactory()Constructor
public function LayoutFactory()

Constructor

Method Detail
degreesToRadians()method
protected static function degreesToRadians(degrees:Number):Number

Converts degrees to radians

Parameters

degrees:Number — value in degrees

Returns
Number — value in radians
dispose()method 
override public function dispose():void

Destructor

getMatrixObj()method 
protected static function getMatrixObj(mtx:Matrix):Object

Converts transformation matrix to TweenMax syntax

Parameters

mtx:Matrix — transformation matrix

Returns
Object — tween matrix
getMaxHeight()method 
protected static function getMaxHeight(c:DisplayObjectContainer):Number

Returns the max height of the container's children

Parameters

c:DisplayObjectContainer — the container

Returns
Number — the max height
getMaxWidth()method 
protected static function getMaxWidth(c:DisplayObjectContainer):Number

Returns the max width of the container's children

Parameters

c:DisplayObjectContainer — the container

Returns
Number — the max width
killTween()method 
public function killTween(child:* = null):void

Kills the tweening of the provided child. If a child is not provided, the group tween is killed.

Parameters

child:* (default = null)

layout()method 
public function layout(container:DisplayObjectContainer):void

The object distribution function. If tween is on, creates a tween for each child and applies the child transformations. If tween is off, assigns the child transformations to the corresponding children.

Parameters

container:DisplayObjectContainer

pointRotateMatrix()method 
protected static function pointRotateMatrix(angle:Number, aroundX:Number, aroundY:Number, m:Matrix = null):Matrix

Returns a matrix rotated around a specific point at a specific angle

Parameters

angle:Number — the angle of rotation
 
aroundX:Number — the x coordinate of the point to rotate around
 
aroundY:Number — the y coordinate of the point to rotate around
 
m:Matrix (default = null) — the matrix to rotate

Returns
Matrix
randomMinMax()method 
protected static function randomMinMax(min:Number, max:Number):Number

Generates a reandom number between min and max

Parameters

min:Number — the bottom limit
 
max:Number — the top limit

Returns
Number — a random number
rotateAroundPoint()method 
protected static function rotateAroundPoint(obj:*, angle:Number, aroundX:Number, aroundY:Number):void

Rotates an object around a spcecific point at a specific angle of rotation

Parameters

obj:* — the object to rotate
 
angle:Number — the angle of rotation
 
aroundX:Number — the x coordinate of the point to rotate around
 
aroundY:Number — the y coordinate of the point to rotate around

rotateTransform()method 
protected function rotateTransform(m:Matrix, rot:Number):void

Apply a rotation to the provided transformation matrix

Parameters

m:Matrix — the transformation matrix
 
rot:Number — the rotation (in radians) to apply

scaleTransform()method 
protected function scaleTransform(m:Matrix, s:Number):void

Apply a scale to the provided transformation matrix

Parameters

m:Matrix — the transformation matrix
 
s:Number — the scale to apply

translateTransform()method 
protected function translateTransform(m:Matrix, x:Number, y:Number):void

Apply a translation to the provided transformation matrix

Parameters

m:Matrix — the transformation matrix
 
x:Number — the x value of the translation
 
y:Number — the y value of the translation

validObject()method 
protected function validObject(obj:*):Boolean

Determines if an object meets the criteria to be included in the layout

Parameters

obj:* — the object to check

Returns
Boolean — true if valid, false otherwise