Packagecom.soma.ui.layouts
Classpublic class LayoutUI
InheritanceLayoutUI Inheritance flash.display.MovieClip
Subclasses CanvasUI, HBoxUI, TileUI, VBoxUI

The LayoutUI class is a base for other layout classes (such as CanvasUI, HBoxUI, VBoxUI, TileUI), but can be used as a basic container. A LayoutUI instance is a DisplayObjectContainer, as it extends MovieClip, and add ElementUI properties (top, right, ratio, etc). The LayoutUI class does not implements any ElementUI properties on its children, it is the difference with the CanvasUI class. The difference between the MovieClip class and the LayoutUI class, beside having ElementUI properties accessible, is that it ensures the instance always have the width and height values (related to its scale) that you have set, even if some children are outside the boundaries. For example, for a LayoutUI instance with a width of 100, that has a children with a width that changes all the time (with a motion) from 100 to 300, The width value returned by the class will always be 100, while a normal DisplayObject class would return values between 100 and 300.

View the examples

See also

com.soma.ui.ElementUI
com.soma.ui.layouts.CanvasUI
com.soma.ui.layouts.HBoxUI
com.soma.ui.layouts.VBoxUI
com.soma.ui.layouts.TileUI


Public Properties
 PropertyDefined By
  alignX : String
Horizontal alignment used when the property ratio is set to ElementUI.RATIO_IN or ElementUI.RATIO_OUT, the value cn be ElementUI.ALIGN_LEFT, ElementUI.ALIGN_RIGHT, ElementUI.ALIGN_CENTER (X axis)
LayoutUI
  alignY : String
Vertical alignment used when the property ratio is set to ElementUI.RATIO_IN or ElementUI.RATIO_OUT, the value can be ElementUI.ALIGN_CENTER, ElementUI.ALIGN_TOP, ElementUI.ALIGN_BOTTOM (Y axis)
LayoutUI
  backgroundAlpha : Number
Transparency of the layout instance background (alpha)
LayoutUI
  backgroundColor : uint
Background color of the layout instance
LayoutUI
  bottom : Number
Distance from the bottom of the reference to the bottom of the layout instance (Y axis)
LayoutUI
  element : ElementUI
[read-only] ElementUI class internally used, it manages the directly accessible layout properties such as top, bottom, ratio, etc.
LayoutUI
  enable : Boolean
Indicates wether or not the ElementUI instance will calculate and update the position and size of the layout instance
LayoutUI
  hideOutsideContent : Boolean
Hide the area of the DisplayObject children that are outside the boundaries (width and height)
LayoutUI
  horizontalCenter : Number
Distance from the middle of the reference to the middle of the layout instance (X axis)
LayoutUI
  left : Number
Distance from the left of the reference to the left of the layout instance (X axis)
LayoutUI
  ratio : String
The ratio is a mode used to make the layout instance fits an area and never get deformed (such as backgrounds for example).
LayoutUI
  reference : DisplayObjectContainer
Reference used to calculate the position and size of the layout instance
LayoutUI
  right : Number
Distance from the right of the reference to the right of the layout instance (X axis)
LayoutUI
  rounded : Boolean
Indicates wether or not the position and size numbers of the layout instance are rounded to the nearest integer
LayoutUI
  top : Number
Distance from the top of the reference to the top of the layout instance (Y axis)
LayoutUI
  verticalCenter : Number
Distance from the middle of the reference to the middle of the layout instance (Y axis)
LayoutUI
Public Methods
 MethodDefined By
  
LayoutUI(reference:DisplayObjectContainer, width:Number = 100, height:Number = 100)
Create a LayoutUI instance
LayoutUI
  
dispose():void
Destroys the instance so it can be garbage collected.
LayoutUI
  
getRealHeight():Number
Get the real height of the layout
LayoutUI
  
getRealWidth():Number
Get the real width of the layout
LayoutUI
  
refresh():void
Calculate and update the position and size of the layout
LayoutUI
  
reset():void
Re-set all the ElementUI instance properties of the layout to initial values (NaN for numbers, and center for alignment)
LayoutUI
Property Detail
alignXproperty
alignX:String

Horizontal alignment used when the property ratio is set to ElementUI.RATIO_IN or ElementUI.RATIO_OUT, the value cn be ElementUI.ALIGN_LEFT, ElementUI.ALIGN_RIGHT, ElementUI.ALIGN_CENTER (X axis)


Implementation
    public function get alignX():String
    public function set alignX(value:String):void

See also

alignYproperty 
alignY:String

Vertical alignment used when the property ratio is set to ElementUI.RATIO_IN or ElementUI.RATIO_OUT, the value can be ElementUI.ALIGN_CENTER, ElementUI.ALIGN_TOP, ElementUI.ALIGN_BOTTOM (Y axis)


Implementation
    public function get alignY():String
    public function set alignY(value:String):void

See also

backgroundAlphaproperty 
backgroundAlpha:Number

Transparency of the layout instance background (alpha)

The default value is 0;.


Implementation
    public function get backgroundAlpha():Number
    public function set backgroundAlpha(value:Number):void
backgroundColorproperty 
backgroundColor:uint

Background color of the layout instance

The default value is 0x000000;.


Implementation
    public function get backgroundColor():uint
    public function set backgroundColor(value:uint):void
bottomproperty 
bottom:Number

Distance from the bottom of the reference to the bottom of the layout instance (Y axis)


Implementation
    public function get bottom():Number
    public function set bottom(value:Number):void

See also

elementproperty 
element:ElementUI  [read-only]

ElementUI class internally used, it manages the directly accessible layout properties such as top, bottom, ratio, etc. The EventUI listeners must be added to it.


Implementation
    public function get element():ElementUI
enableproperty 
enable:Boolean

Indicates wether or not the ElementUI instance will calculate and update the position and size of the layout instance

The default value is true.


Implementation
    public function get enable():Boolean
    public function set enable(value:Boolean):void

See also

hideOutsideContentproperty 
hideOutsideContent:Boolean

Hide the area of the DisplayObject children that are outside the boundaries (width and height)

The default value is false;.


Implementation
    public function get hideOutsideContent():Boolean
    public function set hideOutsideContent(value:Boolean):void
horizontalCenterproperty 
horizontalCenter:Number

Distance from the middle of the reference to the middle of the layout instance (X axis)


Implementation
    public function get horizontalCenter():Number
    public function set horizontalCenter(value:Number):void

See also

leftproperty 
left:Number

Distance from the left of the reference to the left of the layout instance (X axis)


Implementation
    public function get left():Number
    public function set left(value:Number):void

See also

ratioproperty 
ratio:String

The ratio is a mode used to make the layout instance fits an area and never get deformed (such as backgrounds for example). The type of ratio of the ElementUI can be ElementUI.RATIO_IN or ElementUI.RATIO_OUT, any other value will set the ratio to null (default). In the mode ElementUI.RATIO_IN, all the layout instance will be visible (related to the reference). In the mode ElementUI.RATIO_OUT, all the surface of the reference will be covered by the layout instance. The following properties can not be set or are not used when a ratio has been specified: x, y, width, height. The following properties can be used to "offset" the layout instance: horizontalCenter and verticalCenter.

The default value is null.


Implementation
    public function get ratio():String
    public function set ratio(value:String):void

See also

referenceproperty 
reference:DisplayObjectContainer

Reference used to calculate the position and size of the layout instance


Implementation
    public function get reference():DisplayObjectContainer
    public function set reference(value:DisplayObjectContainer):void

See also

rightproperty 
right:Number

Distance from the right of the reference to the right of the layout instance (X axis)


Implementation
    public function get right():Number
    public function set right(value:Number):void

See also

roundedproperty 
rounded:Boolean

Indicates wether or not the position and size numbers of the layout instance are rounded to the nearest integer

The default value is false.


Implementation
    public function get rounded():Boolean
    public function set rounded(value:Boolean):void

See also

topproperty 
top:Number

Distance from the top of the reference to the top of the layout instance (Y axis)


Implementation
    public function get top():Number
    public function set top(value:Number):void

See also

verticalCenterproperty 
verticalCenter:Number

Distance from the middle of the reference to the middle of the layout instance (Y axis)


Implementation
    public function get verticalCenter():Number
    public function set verticalCenter(value:Number):void

See also

Constructor Detail
LayoutUI()Constructor
public function LayoutUI(reference:DisplayObjectContainer, width:Number = 100, height:Number = 100)

Create a LayoutUI instance

Parameters
reference:DisplayObjectContainer — DisplayObjectContainer instance used to calculate the size and position of the layout instance
 
width:Number (default = 100) — width of the layout (not disturbed by children)
 
height:Number (default = 100) — height of the layout (not disturbed by children)

See also

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

Destroys the instance so it can be garbage collected. Automatically called when you remove an object from the BaseUI instance.

See also

com.soma.ui.BaseUI.remove()
com.soma.ui.BaseUI.removeAll()
getRealHeight()method 
public function getRealHeight():Number

Get the real height of the layout

Returns
Number — A Number
getRealWidth()method 
public function getRealWidth():Number

Get the real width of the layout

Returns
Number — A Number
refresh()method 
public function refresh():void

Calculate and update the position and size of the layout

See also

reset()method 
public function reset():void

Re-set all the ElementUI instance properties of the layout to initial values (NaN for numbers, and center for alignment)

See also

Examples
     var layout:LayoutUI = new LayoutUI(stage, 400, 300);
     layout.backgroundColor = 0xFF0000;
     layout.backgroundAlpha = 0.2;
     layout.ratio = ElementUI.RATIO_IN;
     layout.refresh();
     addChild(layout);