Packagecom.soma.ui.layouts
Classpublic class HBoxUI
InheritanceHBoxUI Inheritance LayoutUI Inheritance flash.display.MovieClip

The HBoxUI class extends the LayoutUI class and works in the same way, but it handles the position of its children by aligning them horizontally in the box.

View the examples

See also

com.soma.ui.ElementUI
com.soma.ui.layouts.LayoutUI
com.soma.ui.vo.PaddingUI
com.soma.ui.vo.GapUI


Public Properties
 PropertyDefined By
 InheritedalignX : 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
 InheritedalignY : 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
 InheritedbackgroundAlpha : Number
Transparency of the layout instance background (alpha)
LayoutUI
 InheritedbackgroundColor : uint
Background color of the layout instance
LayoutUI
 Inheritedbottom : Number
Distance from the bottom of the reference to the bottom of the layout instance (Y axis)
LayoutUI
  childrenAlign : String
Property to set the start position and direction of the alignment of the DisplayObject children in the layout.
HBoxUI
  childrenEnable : Boolean
Indicates wether or not the layout will calculate the size and position of the DisplayObject children
HBoxUI
  childrenGap : GapUI
GapUI instance (Value Object) that contains the necessary properties to set the gap value between the DisplayObject children in the layout (horizontal, vertical).
HBoxUI
  childrenPadding : PaddingUI
PaddingUI instance (Value Object) that contains the necessary properties to set the padding value in the layout (left, right, top, bottom).
HBoxUI
 Inheritedelement : ElementUI
[read-only] ElementUI class internally used, it manages the directly accessible layout properties such as top, bottom, ratio, etc.
LayoutUI
 Inheritedenable : Boolean
Indicates wether or not the ElementUI instance will calculate and update the position and size of the layout instance
LayoutUI
 InheritedhideOutsideContent : Boolean
Hide the area of the DisplayObject children that are outside the boundaries (width and height)
LayoutUI
 InheritedhorizontalCenter : Number
Distance from the middle of the reference to the middle of the layout instance (X axis)
LayoutUI
 Inheritedleft : Number
Distance from the left of the reference to the left of the layout instance (X axis)
LayoutUI
 Inheritedratio : 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
 Inheritedreference : DisplayObjectContainer
Reference used to calculate the position and size of the layout instance
LayoutUI
 Inheritedright : Number
Distance from the right of the reference to the right of the layout instance (X axis)
LayoutUI
 Inheritedrounded : Boolean
Indicates wether or not the position and size numbers of the layout instance are rounded to the nearest integer
LayoutUI
 Inheritedtop : Number
Distance from the top of the reference to the top of the layout instance (Y axis)
LayoutUI
 InheritedverticalCenter : Number
Distance from the middle of the reference to the middle of the layout instance (Y axis)
LayoutUI
Public Methods
 MethodDefined By
  
HBoxUI(reference:DisplayObjectContainer, width:Number = 100, height:Number = 100)
Create a HBoxUI instance
HBoxUI
  
dispose():void
[override] Destroys the instance so it can be garbage collected.
HBoxUI
 Inherited
getRealHeight():Number
Get the real height of the layout
LayoutUI
 Inherited
getRealWidth():Number
Get the real width of the layout
LayoutUI
 Inherited
refresh():void
Calculate and update the position and size of the layout
LayoutUI
 Inherited
reset():void
Re-set all the ElementUI instance properties of the layout to initial values (NaN for numbers, and center for alignment)
LayoutUI
Public Constants
 ConstantDefined By
  ALIGN_BOTTOM_LEFT : String = bottom_left
[static] static constant for the children alignment in the layout (property childrenAlign)
HBoxUI
  ALIGN_BOTTOM_RIGHT : String = bottom_right
[static] static constant for the children alignment in the layout (property childrenAlign)
HBoxUI
  ALIGN_CENTER_LEFT : String = center_left
[static] static constant for the children alignment in the layout (property childrenAlign)
HBoxUI
  ALIGN_CENTER_RIGHT : String = center_right
[static] static constant for the children alignment in the layout (property childrenAlign)
HBoxUI
  ALIGN_TOP_LEFT : String = top_left
[static] static constant for the children alignment in the layout (property childrenAlign)
HBoxUI
  ALIGN_TOP_RIGHT : String = top_right
[static] static constant for the children alignment in the layout (property childrenAlign)
HBoxUI
Property Detail
childrenAlignproperty
childrenAlign:String

Property to set the start position and direction of the alignment of the DisplayObject children in the layout. The value can be HBoxUI.ALIGN_TOP_LEFT, HBoxUI.ALIGN_CENTER_LEFT, HBoxUI.ALIGN_BOTTOM_LEFT, HBoxUI.ALIGN_TOP_RIGHT, HBoxUI.ALIGN_CENTER_RIGHT and HBoxUI.ALIGN_BOTTOM_RIGHT.


Implementation
    public function get childrenAlign():String
    public function set childrenAlign(value:String):void
childrenEnableproperty 
childrenEnable:Boolean

Indicates wether or not the layout will calculate the size and position of the DisplayObject children

The default value is true.


Implementation
    public function get childrenEnable():Boolean
    public function set childrenEnable(value:Boolean):void
childrenGapproperty 
childrenGap:GapUI

GapUI instance (Value Object) that contains the necessary properties to set the gap value between the DisplayObject children in the layout (horizontal, vertical). The gap is the distance between each one of the DisplayObject children, horizontally and vertically.


Implementation
    public function get childrenGap():GapUI
    public function set childrenGap(value:GapUI):void

See also

childrenPaddingproperty 
childrenPadding:PaddingUI

PaddingUI instance (Value Object) that contains the necessary properties to set the padding value in the layout (left, right, top, bottom). The padding is the distance between the DisplayObject children and the borders of the layout


Implementation
    public function get childrenPadding():PaddingUI
    public function set childrenPadding(value:PaddingUI):void

See also

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

Create a HBoxUI 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
override public function dispose():void

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

Constant Detail
ALIGN_BOTTOM_LEFTConstant
public static const ALIGN_BOTTOM_LEFT:String = bottom_left

static constant for the children alignment in the layout (property childrenAlign)

ALIGN_BOTTOM_RIGHTConstant 
public static const ALIGN_BOTTOM_RIGHT:String = bottom_right

static constant for the children alignment in the layout (property childrenAlign)

ALIGN_CENTER_LEFTConstant 
public static const ALIGN_CENTER_LEFT:String = center_left

static constant for the children alignment in the layout (property childrenAlign)

ALIGN_CENTER_RIGHTConstant 
public static const ALIGN_CENTER_RIGHT:String = center_right

static constant for the children alignment in the layout (property childrenAlign)

ALIGN_TOP_LEFTConstant 
public static const ALIGN_TOP_LEFT:String = top_left

static constant for the children alignment in the layout (property childrenAlign)

ALIGN_TOP_RIGHTConstant 
public static const ALIGN_TOP_RIGHT:String = top_right

static constant for the children alignment in the layout (property childrenAlign)

Examples
     var hbox:HBoxUI = new HBoxUI(stage, 400, 300);
     hbox.backgroundColor = 0xFF0000;
     hbox.backgroundAlpha = 0.2;
     hbox.ratio = ElementUI.RATIO_IN;
     hbox.childrenGap = new GapUI(5, 5);
     hbox.childrenPadding = new PaddingUI(5, 5, 5, 5);
     hbox.childrenAlign = HBoxUI.ALIGN_BOTTOM_RIGHT;
     addChild(hbox);
     
     for (var i:int=0; i<8; ++i) {
         var sprite:Sprite = new Sprite();
         sprite.graphics.beginFill(0xFF0000, .5);
         sprite.graphics.drawRect(0, 0, 100, 100);
         hbox.addChild(sprite);
     }
     
     hbox.refresh();