Packagespark.layouts
Classpublic class HorizontalLayout
InheritanceHorizontalLayout Inheritance LayoutBase Inheritance OnDemandEventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The HorizontalLayout class arranges the layout elements in a horizontal sequence, left to right, with optional gaps between the elements and optional padding around the elements.

The horizontal position of the elements is determined by arranging them in a horizontal sequence, left to right, taking into account the padding before the first element and the gaps between the elements.

The vertical position of the elements is determined by the layout's verticalAlign property.

During the execution of the measure() method, the default size of the container is calculated by accumulating the preferred sizes of the elements, including gaps and padding. When the requestedColumnCount property is set to a value other than -1, only the space for that many elements is measured, starting from the first element.

During the execution of the updateDisplayList() method, the width of each element is calculated according to the following rules, listed in their respective order of precedence (element's minimum width and maximum width are always respected):

The height of each element is calculated according to the following rules, listed in their respective order of precedence (element's minimum height and maximum height are always respected):

MXML SyntaxexpandedHide MXML Syntax

The <s:HorizontalLayout> tag inherits all of the tag attributes of its superclass and adds the following tag attributes:

  <s:HorizontalLayout 
    Properties
    columnWidth="calculated"
    gap="6"
    paddingBottom="0"
    paddingLeft="0"
    paddingRight="0"
    paddingTop="0"
    requestedColumnCount="-1"
    variableColumnWidth="true"
    verticalAlign="top"
  />
  


Public Properties
 PropertyDefined By
 InheritedclipAndEnableScrolling : Boolean
If true, specifies to clip the children to the boundaries of the viewport.
LayoutBase
  columnCount : int
[read-only] Returns the current number of elements in view.
HorizontalLayout
  columnWidth : Number
If the variableColumnWidth property is false, then this property specifies the actual width of each layout element.
HorizontalLayout
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  firstIndexInView : int
[read-only] The index of the first column that is part of the layout and within the layout target's scroll rectangle, or -1 if nothing has been displayed yet.
HorizontalLayout
  gap : int
The horizontal space between layout elements.
HorizontalLayout
 InheritedhorizontalScrollPosition : Number
The x coordinate of the origin of the viewport in the component's coordinate system, where the default value is (0,0) corresponding to the upper-left corner of the component.
LayoutBase
  lastIndexInView : int
[read-only] The index of the last column that is part of the layout and within the layout target's scroll rectangle, or -1 if nothing has been displayed yet.
HorizontalLayout
  paddingBottom : Number
The minimum number of pixels between the container's bottom edge and the bottom of all the container's layout elements.
HorizontalLayout
  paddingLeft : Number
Number of pixels between the container's left edge and the left edge of the first layout element.
HorizontalLayout
  paddingRight : Number
Number of pixels between the container's right edge and the right edge of the last layout element.
HorizontalLayout
  paddingTop : Number
The minimum number of pixels between the container's top edge and the top of all the container's layout elements.
HorizontalLayout
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  requestedColumnCount : int
The measured size of this layout is wide enough to display the first requestedColumnCount layout elements.
HorizontalLayout
 Inheritedtarget : GroupBase
The GroupBase container whose elements are measured, sized and positioned by this layout.
LayoutBase
 InheritedtypicalLayoutElement : ILayoutElement
Used by layouts when fixed row/column sizes are requested but a specific size isn't specified.
LayoutBase
 InheriteduseVirtualLayout : Boolean
A container can hold any number of children.
LayoutBase
  variableColumnWidth : Boolean
If true, specifies that layout elements are to be allocated their preferred width.
HorizontalLayout
  verticalAlign : String
The vertical alignment of layout elements.
HorizontalLayout
 InheritedverticalScrollPosition : Number
The y coordinate of the origin of the viewport in the component's coordinate system, where the default value is (0,0) corresponding to the upper-left corner of the component.
LayoutBase
Public Methods
 MethodDefined By
  
Constructor.
HorizontalLayout
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
OnDemandEventDispatcher
 Inherited
When useVirtualLayout is true, this method can be used by the layout target to clear cached layout information when the target changes.
LayoutBase
 Inherited
OnDemandEventDispatcher
 Inherited
Called by the target after a layout element has been added and before the target's size and display list are validated.
LayoutBase
 Inherited
This method must is called by the target after a layout element has been removed and before the target's size and display list are validated.
LayoutBase
  
Returns 1.0 if the specified index is completely in view, 0.0 if it's not, or a value between 0.0 and 1.0 that represents the percentage of the if the index that is partially in view.
HorizontalLayout
 Inherited
Returns the change to the horizontal scroll position to handle different scrolling options.
LayoutBase
 Inherited
getNavigationDestinationIndex(currentIndex:int, navigationUnit:uint, arrowKeysWrapFocus:Boolean):int
Delegation method that determines which item to navigate to based on the current item in focus and user input in terms of NavigationUnit.
LayoutBase
 Inherited
Computes the verticalScrollPosition and horizontalScrollPosition deltas needed to scroll the element at the specified index into view.
LayoutBase
 Inherited
Returns the change to the horizontal scroll position to handle different scrolling options.
LayoutBase
 Inherited
OnDemandEventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Measures the target's default size based on its content, and optionally measures the target's default minimum size.
LayoutBase
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
OnDemandEventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Sizes and positions the target's elements.
LayoutBase
 Inherited
Called by the target at the end of its updateDisplayList to have the layout update its scrollRect.
LayoutBase
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
OnDemandEventDispatcher
Protected Methods
 MethodDefined By
 Inherited
Returns the specified element's layout bounds as a Rectangle or null if the index is invalid, the corresponding element is null, includeInLayout=false, or if this layout's target property is null.
LayoutBase
 Inherited
Returns the bounds of the first layout element that either spans or is above the scrollRect's top edge.
LayoutBase
 Inherited
Returns the bounds of the first layout element that either spans or is below the scrollRect's bottom edge.
LayoutBase
 Inherited
Returns the bounds of the first layout element that either spans or is to the left of the scrollRect's left edge.
LayoutBase
 Inherited
Returns the bounds of the first layout element that either spans or is to the right of the scrollRect's right edge.
LayoutBase
 Inherited
Returns the bounds of the target's scroll rectangle in layout coordinates.
LayoutBase
 Inherited
Called when the verticalScrollPosition or horizontalScrollPosition properties change.
LayoutBase
Property Detail
columnCountproperty
columnCount:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Returns the current number of elements in view.

The default value is -1.

This property can be used as the source for data binding. When this property is modified, it dispatches the propertyChange event.



Implementation
    public function get columnCount():int
columnWidthproperty 
columnWidth:Number

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

If the variableColumnWidth property is false, then this property specifies the actual width of each layout element.

If the variableColumnWidth property is true, the default, then this property has no effect.

The default value of this property is the preferred width of the item specified by the typicalLayoutElement property.



Implementation
    public function get columnWidth():Number
    public function set columnWidth(value:Number):void
firstIndexInViewproperty 
firstIndexInView:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The index of the first column that is part of the layout and within the layout target's scroll rectangle, or -1 if nothing has been displayed yet. Note that the column may only be partially in view.

This property can be used as the source for data binding. When this property is modified, it dispatches the propertyChange event.



Implementation
    public function get firstIndexInView():int

See also

lastIndexInView
fractionOfElementInView
gapproperty 
gap:int

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The horizontal space between layout elements. Note that the gap is only applied between layout elements, so if there's just one element, the gap has no effect on the layout.

The default value is 6.



Implementation
    public function get gap():int
    public function set gap(value:int):void
lastIndexInViewproperty 
lastIndexInView:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The index of the last column that is part of the layout and within the layout target's scroll rectangle, or -1 if nothing has been displayed yet. Note that the column may only be partially in view.

This property can be used as the source for data binding. When this property is modified, it dispatches the propertyChange event.



Implementation
    public function get lastIndexInView():int

See also

firstIndexInView
fractionOfElementInView
paddingBottomproperty 
paddingBottom:Number

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The minimum number of pixels between the container's bottom edge and the bottom of all the container's layout elements.

The default value is 0.



Implementation
    public function get paddingBottom():Number
    public function set paddingBottom(value:Number):void
paddingLeftproperty 
paddingLeft:Number

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Number of pixels between the container's left edge and the left edge of the first layout element.

The default value is 0.



Implementation
    public function get paddingLeft():Number
    public function set paddingLeft(value:Number):void
paddingRightproperty 
paddingRight:Number

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Number of pixels between the container's right edge and the right edge of the last layout element.

The default value is 0.



Implementation
    public function get paddingRight():Number
    public function set paddingRight(value:Number):void
paddingTopproperty 
paddingTop:Number

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The minimum number of pixels between the container's top edge and the top of all the container's layout elements.

The default value is 0.



Implementation
    public function get paddingTop():Number
    public function set paddingTop(value:Number):void
requestedColumnCountproperty 
requestedColumnCount:int

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The measured size of this layout is wide enough to display the first requestedColumnCount layout elements. If requestedColumnCount is -1, then the measured size will be big enough for all of the layout elements.

If the actual size of the container using this layout has been explicitly set, then this property has no effect.

The default value is -1.



Implementation
    public function get requestedColumnCount():int
    public function set requestedColumnCount(value:int):void
variableColumnWidthproperty 
variableColumnWidth:Boolean

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

If true, specifies that layout elements are to be allocated their preferred width.

Setting this property to false specifies fixed width columns. The actual width of each layout element is the value of the columnWidth property, and the layout ignores a layout elements' percentWidth property.

The default value is true.



Implementation
    public function get variableColumnWidth():Boolean
    public function set variableColumnWidth(value:Boolean):void
verticalAlignproperty 
verticalAlign:String

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The vertical alignment of layout elements.

If the value is "bottom", "middle", or "top" then the layout elements are aligned relative to the container's contentHeight property.

If the value is "contentJustify" then the actual height of the layout element is set to the container's contentHeight property. The content height of the container is the height of the largest layout element. If all layout elements are smaller than the height of the container, then set the height of all the layout elements to the height of the container.

If the value is "justify" then the actual height of the layout elements is set to the container's height.

This property does not affect the layout's measured size.

The default value is "top".



Implementation
    public function get verticalAlign():String
    public function set verticalAlign(value:String):void
Constructor Detail
HorizontalLayout()Constructor
public function HorizontalLayout()

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Constructor.

Method Detail
fractionOfElementInView()method
public function fractionOfElementInView(index:int):Number

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Returns 1.0 if the specified index is completely in view, 0.0 if it's not, or a value between 0.0 and 1.0 that represents the percentage of the if the index that is partially in view.

An index is "in view" if the corresponding non-null layout element is within the horizontal limits of the container's scrollRect and included in the layout.

If the specified index is partially within the view, the returned value is the percentage of the corresponding layout element that's visible.

Parameters

index:int — The index of the column.

Returns
Number — The percentage of the specified element that's in view. Returns 0.0 if the specified index is invalid or if it corresponds to null element, or a ILayoutElement for which the includeInLayout property is false.