Packagecom.gestureworks.cml.layouts
Classpublic class RandomLayout
InheritanceRandomLayout Inheritance LayoutFactory Inheritance ObjectFactory Inheritance flash.events.EventDispatcher

The RandomLayout positions display objects randomly about the x- and y-axes and applies a specified amount of random rotation.

Allowable types are: randomX, randomY, randomXY, randomXYRotation

Default type is: RandomXY.

            
        var randomContainer:TouchContainer = getImageContainer();
        randomContainer.x = 500;
        randomContainer.y = 20;
        addChild(randomContainer);
        
        var randomLayout:RandomLayout = new RandomLayout();
        randomLayout.maxX = 400;
        randomLayout.maxY = 500;
        randomLayout.minRot = -30;
        randomLayout.maxRot = 30;
        randomLayout.type = "randomXYRotation";
        randomLayout.tween = true;
        randomLayout.tweenTime = 1500;
        randomContainer.applyLayout(randomLayout);
                        
        
        function getImageContainer():TouchContainer
        {
            var container:TouchContainer = new TouchContainer();
            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 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
GridLayout
ListLayout
PileLayout
RandomLayout
LayoutFactory


Public Properties
 PropertyDefined By
 Inheritedalpha : Number
Specifies the alpha value of the display objects in the layout
LayoutFactory
 InheritedcacheTransforms : Boolean
Flag indicating the childTransformations are to be cached and reapplied for convenience.
LayoutFactory
 InheritedcenterColumn : Boolean
Flag indicating the alignment of the objects' centers with the center of the column.
LayoutFactory
 InheritedcenterRow : Boolean
Flag indicating the alignment of the objects' centers with the center of the row.
LayoutFactory
 InheritedcmlIndex : int
sets the index of cml
ObjectFactory
 InheritedcontinuousTransform : Boolean
Flag indicating the application of a transform relative to the current transform.
LayoutFactory
 Inheritedeasing : *
Specifies the easing equation.
LayoutFactory
 Inheritedexclusions : Array
An array of objects to exclude from the layout application
LayoutFactory
 Inheritedid : String
sets the id
ObjectFactory
 InheritedmarginX : Number
LayoutFactory
 InheritedmarginY : Number
Spacing added to the height of an object
LayoutFactory
  maxRot : Number
The maximum rotation value.
RandomLayout
  maxX : Number
The minimum random y value.
RandomLayout
  maxY : Number
The maximum random y value.
RandomLayout
  minRot : Number
The minimum rotation value.
RandomLayout
  minX : Number
The minimum random x value.
RandomLayout
  minY : Number
The minimum random y value.
RandomLayout
 InheritedonComplete : Function
Function to call on layout complete
LayoutFactory
 InheritedonUpdate : Function
Function to call on layout update
LayoutFactory
 InheritedoriginX : Number
Starting x coordinate of layout relative to the container
LayoutFactory
 Inherited_originY : Number = 0
LayoutFactory
 InheritedoriginY : Number
Starting y coordinate of layout relative to the container
LayoutFactory
 InheritedpropertyStates : Array
Deprecated: Please Use state
ObjectFactory
  rotation : Number
[override] Since this is a rotaion dependent layout, override rotation mutator to prevent conflicts.
RandomLayout
 Inheritedscale : Number
Specifies the scale value of the display objects in the layout
LayoutFactory
 InheritedspacingX : Number
Horizontal distance between the origins of two objects
LayoutFactory
 InheritedspacingY : Number
Vertical distance between the origins of two objects
LayoutFactory
 Inheritedstate : Array
property states array
ObjectFactory
 Inheritedtween : Boolean
Flag indicating the display objects will animate to their layout positions.
LayoutFactory
 InheritedtweenTime : Number
The time(ms) the display objects will take to move into positions
LayoutFactory
 Inheritedtype : String
Specifies a layout subtype
LayoutFactory
 InheriteduseMargins : Boolean
Flag indicating the use of margins or spacing
LayoutFactory
Protected Properties
 PropertyDefined By
 InheritedchildTransformations : Array
LayoutFactory
Public Methods
 MethodDefined By
  
Constructor
RandomLayout
 Inherited
clone():*
Returns clone of self
ObjectFactory
  
dispose():void
[override] Disposal method
RandomLayout
 Inherited
killTween(child:* = null):void
Kills the tweening of the provided child.
LayoutFactory
  
layout(container:DisplayObjectContainer):void
[override] Apply layout type to container object Object passed must implement DisplayObjectContainer
RandomLayout
 Inherited
parseCML(cml:XMLList):XMLList
parses cml file
ObjectFactory
 Inherited
postparseCML(cml:XMLList):void
postparse method
ObjectFactory
  
randomX(container:DisplayObjectContainer):void
Distributes the the children of the container randomly about the x-axis.
RandomLayout
  
randomXY(container:DisplayObjectContainer):void
Distributes the the children of the container randomly about the x,y-axes.
RandomLayout
  
randomXYRotation(container:DisplayObjectContainer):void
Distributes the the children of the container randomly about the x,y-axes and applies a random amount of rotation.
RandomLayout
  
randomY(container:DisplayObjectContainer):void
Distributes the the children of the container randomly about the y-axis.
RandomLayout
 Inherited
updateProperties(state:Number = 0):void
update the properties
ObjectFactory
Protected Methods
 MethodDefined By
 Inherited
degreesToRadians(degrees:Number):Number
[static] Converts degrees to radians
LayoutFactory
 Inherited
getMatrixObj(mtx:Matrix):Object
[static] Converts transformation matrix to TweenMax syntax
LayoutFactory
 Inherited
getMaxHeight(c:DisplayObjectContainer):Number
[static] Returns the max height of the container's children
LayoutFactory
 Inherited
getMaxWidth(c:DisplayObjectContainer):Number
[static] Returns the max width of the container's children
LayoutFactory
 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
LayoutFactory
 Inherited
randomMinMax(min:Number, max:Number):Number
[static] Generates a reandom number between min and max
LayoutFactory
 Inherited
rotateAroundPoint(obj:*, angle:Number, aroundX:Number, aroundY:Number):void
[static] Rotates an object around a spcecific point at a specific angle of rotation
LayoutFactory
 Inherited
rotateTransform(m:Matrix, rot:Number):void
Apply a rotation to the provided transformation matrix
LayoutFactory
 Inherited
scaleTransform(m:Matrix, s:Number):void
Apply a scale to the provided transformation matrix
LayoutFactory
 Inherited
translateTransform(m:Matrix, x:Number, y:Number):void
Apply a translation to the provided transformation matrix
LayoutFactory
 Inherited
validObject(obj:*):Boolean
Determines if an object meets the criteria to be included in the layout
LayoutFactory
Property Detail
maxRotproperty
maxRot:Number

The maximum rotation value.

The default value is 360.


Implementation
    public function get maxRot():Number
    public function set maxRot(value:Number):void
maxXproperty 
maxX:Number

The minimum random y value.

The default value is 500.


Implementation
    public function get maxX():Number
    public function set maxX(value:Number):void
maxYproperty 
maxY:Number

The maximum random y value.

The default value is 500.


Implementation
    public function get maxY():Number
    public function set maxY(value:Number):void
minRotproperty 
minRot:Number

The minimum rotation value.

The default value is 0.


Implementation
    public function get minRot():Number
    public function set minRot(value:Number):void
minXproperty 
minX:Number

The minimum random x value.

The default value is 0.


Implementation
    public function get minX():Number
    public function set minX(value:Number):void
minYproperty 
minY:Number

The minimum random y value.

The default value is 0.


Implementation
    public function get minY():Number
    public function set minY(value:Number):void
rotationproperty 
rotation:Number[override]

Since this is a rotaion dependent layout, override rotation mutator to prevent conflicts.


Implementation
    public function get rotation():Number
    public function set rotation(value:Number):void
Constructor Detail
RandomLayout()Constructor
public function RandomLayout()

Constructor

Method Detail
dispose()method
override public function dispose():void

Disposal method

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

Apply layout type to container object Object passed must implement DisplayObjectContainer

Parameters

container:DisplayObjectContainer

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

Distributes the the children of the container randomly about the x-axis.

Parameters

container:DisplayObjectContainer

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

Distributes the the children of the container randomly about the x,y-axes.

Parameters

container:DisplayObjectContainer

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

Distributes the the children of the container randomly about the x,y-axes and applies a random amount of rotation. The maximum x,y value is equal to the container's width, height

Parameters

container:DisplayObjectContainer

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

Distributes the the children of the container randomly about the y-axis.

Parameters

container:DisplayObjectContainer