| Package | feathers.layout |
| Class | public class HorizontalLayout |
| Inheritance | HorizontalLayout EventDispatcher Object |
| Implements | IVariableVirtualLayout, ITrimmedVirtualLayout |
See also
| Property | Defined By | ||
|---|---|---|---|
| afterVirtualizedItemCount : int
The number of virtualized items that appear after the items passed
to layout(). | HorizontalLayout | ||
| beforeVirtualizedItemCount : int
The number of virtualized items that appear before the items passed
to layout(). | HorizontalLayout | ||
| gap : Number
The space, in pixels, between items. | HorizontalLayout | ||
| hasVariableItemDimensions : Boolean
When the layout is virtualized, and this value is true, the items may
have variable dimensions. | HorizontalLayout | ||
| horizontalAlign : String
If the total item width is less than the bounds, the positions of
the items can be aligned horizontally. | HorizontalLayout | ||
| padding : Number
Quickly sets all padding properties to the same value. | HorizontalLayout | ||
| paddingBottom : Number
The minimum space, in pixels, above the items. | HorizontalLayout | ||
| paddingLeft : Number
The space, in pixels, before the first item. | HorizontalLayout | ||
| paddingRight : Number
The space, in pixels, after the last item. | HorizontalLayout | ||
| paddingTop : Number
The minimum space, in pixels, above the items. | HorizontalLayout | ||
| scrollPositionHorizontalAlign : String
When the scroll position is calculated for an item, an attempt will
be made to align the item to this position. | HorizontalLayout | ||
| typicalItemHeight : Number
The height, in pixels, of a "typical" item that is used to virtually
fill in blanks for the layout. | HorizontalLayout | ||
| typicalItemWidth : Number
The width, in pixels, of a "typical" item that is used to virtually
fill in blanks for the layout. | HorizontalLayout | ||
| useVirtualLayout : Boolean
Determines if virtual layout can be used. | HorizontalLayout | ||
| verticalAlign : String
The alignment of the items vertically, on the y-axis. | HorizontalLayout | ||
| Method | Defined By | ||
|---|---|---|---|
Constructor. | HorizontalLayout | ||
![]() | addEventListener(type:String, listener:Function):void Registers an event listener at a certain object. | EventDispatcher | |
addToVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void
Inserts an item in to the cache at the specified index, pushing the
old cached value at that index, and all following values, up one
index. | HorizontalLayout | ||
![]() | dispatchEvent(event:Event):void Dispatches an event to all objects that have registered listeners for its type. | EventDispatcher | |
![]() | dispatchEventWith(type:String, bubbles:Boolean = false, data:Object = null):void Dispatches an event with the given parameters to all objects that have registered
listeners for the given type. | EventDispatcher | |
getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
Using the item dimensions, calculates a scroll position that will
ensure that the item at a given index will be visible within the
specified bounds. | HorizontalLayout | ||
getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int>
Determines which indices are visible with the specified view port
bounds and scroll position. | HorizontalLayout | ||
![]() | hasEventListener(type:String):Boolean Returns if there are listeners registered for a certain event type. | EventDispatcher | |
layout(items:Vector.<DisplayObject>, suggestedBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult
Positions (and possibly resizes) the supplied items within the
optional bounds argument. | HorizontalLayout | ||
measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point
Using the typical item bounds and suggested bounds, returns a set of
calculated dimensions for the view port. | HorizontalLayout | ||
![]() | removeEventListener(type:String, listener:Function):void Removes an event listener from the object. | EventDispatcher | |
![]() | removeEventListeners(type:String = null):void Removes all event listeners with a certain type, or all of them if type is null. | EventDispatcher | |
removeFromVariableVirtualCacheAtIndex(index:int):void
Removes an item in to the cache at the specified index, moving the
values at following indexes down by one. | HorizontalLayout | ||
resetVariableVirtualCache():void
Clears the cached dimensions for all virtualized indices. | HorizontalLayout | ||
resetVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void
Clears the cached dimensions for one specific virtualized index. | HorizontalLayout | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| HorizontalLayout | ||||
| Constant | Defined By | ||
|---|---|---|---|
| HORIZONTAL_ALIGN_CENTER : String = center [static]
If the total item width is smaller than the width of the bounds, the
items will be aligned to the center. | HorizontalLayout | ||
| HORIZONTAL_ALIGN_LEFT : String = left [static]
If the total item width is smaller than the width of the bounds, the
items will be aligned to the left. | HorizontalLayout | ||
| HORIZONTAL_ALIGN_RIGHT : String = right [static]
If the total item width is smaller than the width of the bounds, the
items will be aligned to the right. | HorizontalLayout | ||
| VERTICAL_ALIGN_BOTTOM : String = bottom [static]
The items will be aligned to the bottom of the bounds. | HorizontalLayout | ||
| VERTICAL_ALIGN_JUSTIFY : String = justify [static]
The items will fill the height of the bounds. | HorizontalLayout | ||
| VERTICAL_ALIGN_MIDDLE : String = middle [static]
The items will be aligned to the middle of the bounds. | HorizontalLayout | ||
| VERTICAL_ALIGN_TOP : String = top [static]
The items will be aligned to the top of the bounds. | HorizontalLayout | ||
| afterVirtualizedItemCount | property |
afterVirtualizedItemCount:int
The number of virtualized items that appear after the items passed
to layout(). Allows the array of items to be smaller
than the full size. Does not work if the layout has variable item
dimensions.
public function get afterVirtualizedItemCount():int public function set afterVirtualizedItemCount(value:int):void| beforeVirtualizedItemCount | property |
beforeVirtualizedItemCount:int
The number of virtualized items that appear before the items passed
to layout(). Allows the array of items to be smaller
than the full size. Does not work if the layout has variable item
dimensions.
public function get beforeVirtualizedItemCount():int public function set beforeVirtualizedItemCount(value:int):void| gap | property |
gap:NumberThe space, in pixels, between items.
public function get gap():Number public function set gap(value:Number):void| hasVariableItemDimensions | property |
hasVariableItemDimensions:BooleanWhen the layout is virtualized, and this value is true, the items may have variable dimensions. If false, the items will all share the same dimensions as the typical item. Performance is better for layouts where all items have the same dimensions.
public function get hasVariableItemDimensions():Boolean public function set hasVariableItemDimensions(value:Boolean):void| horizontalAlign | property |
horizontalAlign:StringIf the total item width is less than the bounds, the positions of the items can be aligned horizontally.
public function get horizontalAlign():String public function set horizontalAlign(value:String):void| padding | property |
padding:Number
Quickly sets all padding properties to the same value. The
padding getter always returns the value of
paddingTop, but the other padding values may be
different.
public function get padding():Number public function set padding(value:Number):void| paddingBottom | property |
paddingBottom:NumberThe minimum space, in pixels, above the items.
public function get paddingBottom():Number public function set paddingBottom(value:Number):void| paddingLeft | property |
paddingLeft:NumberThe space, in pixels, before the first item.
public function get paddingLeft():Number public function set paddingLeft(value:Number):void| paddingRight | property |
paddingRight:NumberThe space, in pixels, after the last item.
public function get paddingRight():Number public function set paddingRight(value:Number):void| paddingTop | property |
paddingTop:NumberThe minimum space, in pixels, above the items.
public function get paddingTop():Number public function set paddingTop(value:Number):void| scrollPositionHorizontalAlign | property |
scrollPositionHorizontalAlign:StringWhen the scroll position is calculated for an item, an attempt will be made to align the item to this position.
public function get scrollPositionHorizontalAlign():String public function set scrollPositionHorizontalAlign(value:String):void| typicalItemHeight | property |
typicalItemHeight:Number
The height, in pixels, of a "typical" item that is used to virtually
fill in blanks for the layout. This value is usually set by a
component that is using the layout, such as a List or
a ScrollContainer. In most cases, unless you are
creating a new custom component that supports layouts, you should
never need to set this value.
public function get typicalItemHeight():Number public function set typicalItemHeight(value:Number):void| typicalItemWidth | property |
typicalItemWidth:Number
The width, in pixels, of a "typical" item that is used to virtually
fill in blanks for the layout. This value is usually set by a
component that is using the layout, such as a List or
a ScrollContainer. In most cases, unless you are
creating a new custom component that supports layouts, you should
never need to set this value.
public function get typicalItemWidth():Number public function set typicalItemWidth(value:Number):void| useVirtualLayout | property |
useVirtualLayout:BooleanDetermines if virtual layout can be used. Some components don't support virtual layouts. In those cases, the virtual layout options will be ignored.
public function get useVirtualLayout():Boolean public function set useVirtualLayout(value:Boolean):void| verticalAlign | property |
verticalAlign:StringThe alignment of the items vertically, on the y-axis.
public function get verticalAlign():String public function set verticalAlign(value:String):void| HorizontalLayout | () | Constructor |
public function HorizontalLayout()Constructor.
| addToVariableVirtualCacheAtIndex | () | method |
public function addToVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):voidInserts an item in to the cache at the specified index, pushing the old cached value at that index, and all following values, up one index.
Parameters
index:int | |
item:DisplayObject (default = null) |
| getScrollPositionForIndex | () | method |
public function getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):PointUsing the item dimensions, calculates a scroll position that will ensure that the item at a given index will be visible within the specified bounds.
Parameters
index:int | |
items:Vector.<DisplayObject> | |
x:Number | |
y:Number | |
width:Number | |
height:Number | |
result:Point (default = null) |
Point |
| getVisibleIndicesAtScrollPosition | () | method |
public function getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int>Determines which indices are visible with the specified view port bounds and scroll position. Indices that aren't returned are typically not displayed and can be replaced virtually.
Parameters
scrollX:Number | |
scrollY:Number | |
width:Number | |
height:Number | |
itemCount:int | |
result:Vector.<int> (default = null) |
Vector.<int> |
| layout | () | method |
public function layout(items:Vector.<DisplayObject>, suggestedBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResultPositions (and possibly resizes) the supplied items within the optional bounds argument. If no bounds are specified, the layout algorithm will assume that the bounds start a 0,0 and have unbounded dimensions. Returns the actual bounds of the content, which may be different than the specified bounds.
Note: The items are not absolutely restricted to appear only within the bounds. The bounds can affect positioning, but the algorithm may very well ignore them completely.
If a layout implementation needs to access accurate width
and height values from items that are of type
IFeathersControl, it must call validate()
manually. For performance reasons, the container that is the parent
of the items will not call validate() before passing the
items to a layout implementation. Meeting this requirement may be as
simple as looping through the items at the beginning of
layout() and validating all items that are Feathers UI
controls:
const itemCount:int = items.length;
for(var i:int = 0; i < itemCount; i++)
{
var item:IFeathersControl = items[i] as IFeathersControl;
if(item)
{
item.validate();
}
}Parameters
items:Vector.<DisplayObject> | |
suggestedBounds:ViewPortBounds (default = null) | |
result:LayoutBoundsResult (default = null) |
LayoutBoundsResult |
| measureViewPort | () | method |
public function measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):PointUsing the typical item bounds and suggested bounds, returns a set of calculated dimensions for the view port.
Parameters
itemCount:int | |
viewPortBounds:ViewPortBounds (default = null) | |
result:Point (default = null) |
Point |
| removeFromVariableVirtualCacheAtIndex | () | method |
public function removeFromVariableVirtualCacheAtIndex(index:int):voidRemoves an item in to the cache at the specified index, moving the values at following indexes down by one.
Parameters
index:int |
| resetVariableVirtualCache | () | method |
public function resetVariableVirtualCache():voidClears the cached dimensions for all virtualized indices.
| resetVariableVirtualCacheAtIndex | () | method |
public function resetVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):voidClears the cached dimensions for one specific virtualized index.
Parameters
index:int | |
item:DisplayObject (default = null) |
| change | Event |
| HORIZONTAL_ALIGN_CENTER | Constant |
public static const HORIZONTAL_ALIGN_CENTER:String = centerIf the total item width is smaller than the width of the bounds, the items will be aligned to the center.
| HORIZONTAL_ALIGN_LEFT | Constant |
public static const HORIZONTAL_ALIGN_LEFT:String = leftIf the total item width is smaller than the width of the bounds, the items will be aligned to the left.
| HORIZONTAL_ALIGN_RIGHT | Constant |
public static const HORIZONTAL_ALIGN_RIGHT:String = rightIf the total item width is smaller than the width of the bounds, the items will be aligned to the right.
| VERTICAL_ALIGN_BOTTOM | Constant |
public static const VERTICAL_ALIGN_BOTTOM:String = bottomThe items will be aligned to the bottom of the bounds.
| VERTICAL_ALIGN_JUSTIFY | Constant |
public static const VERTICAL_ALIGN_JUSTIFY:String = justifyThe items will fill the height of the bounds.
| VERTICAL_ALIGN_MIDDLE | Constant |
public static const VERTICAL_ALIGN_MIDDLE:String = middleThe items will be aligned to the middle of the bounds.
| VERTICAL_ALIGN_TOP | Constant |
public static const VERTICAL_ALIGN_TOP:String = topThe items will be aligned to the top of the bounds.