Package | com.gestureworks.cml.layouts |
Class | public class RandomLayout |
Inheritance | RandomLayout LayoutFactory ObjectFactory flash.events.EventDispatcher |
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
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 | ||
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 | ||
marginX : Number | LayoutFactory | ||
marginY : 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 | ||
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 [override]
Since this is a rotaion dependent layout, override rotation mutator to prevent conflicts. | RandomLayout | ||
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
| RandomLayout | ||
clone():*
Returns clone of self
| ObjectFactory | ||
dispose():void [override]
Disposal method
| RandomLayout | ||
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 | ||
parseCML(cml:XMLList):XMLList
parses cml file
| ObjectFactory | ||
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 | ||
updateProperties(state:Number = 0):void
update the properties
| ObjectFactory |
maxRot | property |
maxRot:Number
The maximum rotation value.
The default value is 360
.
public function get maxRot():Number
public function set maxRot(value:Number):void
maxX | property |
maxX:Number
The minimum random y value.
The default value is 500
.
public function get maxX():Number
public function set maxX(value:Number):void
maxY | property |
maxY:Number
The maximum random y value.
The default value is 500
.
public function get maxY():Number
public function set maxY(value:Number):void
minRot | property |
minRot:Number
The minimum rotation value.
The default value is 0
.
public function get minRot():Number
public function set minRot(value:Number):void
minX | property |
minX:Number
The minimum random x value.
The default value is 0
.
public function get minX():Number
public function set minX(value:Number):void
minY | property |
minY:Number
The minimum random y value.
The default value is 0
.
public function get minY():Number
public function set minY(value:Number):void
rotation | property |
rotation:Number
[override] Since this is a rotaion dependent layout, override rotation mutator to prevent conflicts.
public function get rotation():Number
public function set rotation(value:Number):void
RandomLayout | () | Constructor |
public function RandomLayout()
Constructor
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 |