| Package | feathers.layout | 
| Class | public class FlowLayout | 
| Inheritance | FlowLayout    BaseVariableVirtualLayout   starling.events.EventDispatcher | 
| Implements | IVariableVirtualLayout, IDragDropLayout | 
| Product Version : | Feathers 2.2.0 | 
See also
| Property | Defined By | ||
|---|---|---|---|
| firstHorizontalGap : Number 
		 The space, in pixels, between the first and second items.  | FlowLayout | ||
| gap : Number 
		 Quickly sets both horizontalGap and verticalGap
		 to the same value.  | FlowLayout | ||
![]()  | hasVariableItemDimensions : Boolean 
		 When the layout is virtualized, and this value is true, the items
		 may have variable dimensions.  | BaseVariableVirtualLayout | |
| horizontalAlign : String 
		 If the total row width is less than the bounds, the items in the row
		 can be aligned horizontally.  | FlowLayout | ||
| horizontalGap : Number 
		 The horizontal space, in pixels, between items.  | FlowLayout | ||
| lastHorizontalGap : Number 
		 The space, in pixels, between the last and second to last items.  | FlowLayout | ||
| padding : Number 
		 Quickly sets all padding properties to the same value.  | FlowLayout | ||
| paddingBottom : Number 
		 The space, in pixels, below the items.  | FlowLayout | ||
| paddingLeft : Number 
		 The space, in pixels, to the left of the items.  | FlowLayout | ||
| paddingRight : Number 
		 The space, in pixels, to the right of the items.  | FlowLayout | ||
| paddingTop : Number 
		 The space, in pixels, above of items.  | FlowLayout | ||
![]()  | requiresLayoutOnScroll : Boolean [read-only] 
		 Determines if the container calls layout() when the
		 scroll position changes.  | BaseVariableVirtualLayout | |
| rowVerticalAlign : String 
		 If the height of an item is less than the height of a row, it can be
		 aligned vertically.  | FlowLayout | ||
![]()  | typicalItem : DisplayObject 
		 Used internally by a component that supports layout virtualization,
		 such as List, to provide a display object with
		 dimensions that represent a "typical" item in the layout.  | BaseVariableVirtualLayout | |
![]()  | useVirtualLayout : Boolean 
		 Determines if virtual layout should be used.  | BaseVariableVirtualLayout | |
| verticalAlign : String 
		 If the total height of the content is less than the bounds, the
		 content may be aligned vertically.  | FlowLayout | ||
| verticalGap : Number 
		 The vertical space, in pixels, between items.  | FlowLayout | ||
| Method | Defined By | ||
|---|---|---|---|
		 Constructor.  | FlowLayout | ||
addToVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void [override] 
		 
		 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.  | FlowLayout | ||
calculateNavigationDestination(items:Vector.<DisplayObject>, index:int, keyCode:uint, bounds:LayoutBoundsResult):int 
		 
		 Using the current index and a key press, calculates the new index.  | FlowLayout | ||
getDropIndex(x:Number, y:Number, items:Vector.<DisplayObject>, boundsX:Number, boundsY:Number, width:Number, height:Number):int 
		 
		 Returns the index of the item if it were dropped at the specified
		 location.  | FlowLayout | ||
getNearestScrollPositionForIndex(index:int, scrollX:Number, scrollY:Number, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point 
		 
		 Calculates the scroll position nearest to the current scroll position
		 that will display the full bounds of the item within the view port.  | FlowLayout | ||
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.  | FlowLayout | ||
getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int> 
		 
		 Used internally by a component, such as List, to
		 determines which indices are visible with the specified view port
		 bounds and scroll position.  | FlowLayout | ||
layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult 
		 
		 Positions (and possibly resizes) the supplied items within the
		 optional bounds argument.  | FlowLayout | ||
measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point 
		 
		 Used internally by a component, such as List, to measure
		 the view port based on the typical item dimensions or cached
		 dimensions, if available.  | FlowLayout | ||
positionDropIndicator(dropIndicator:DisplayObject, index:int, x:Number, y:Number, items:Vector.<DisplayObject>, width:Number, height:Number):void 
		 
		 Positions the drop indicator in the layout.  | FlowLayout | ||
removeFromVariableVirtualCacheAtIndex(index:int):void [override] 
		 
		 Removes an item in to the cache at the specified index, moving the
		 values at following indexes down by one.  | FlowLayout | ||
resetVariableVirtualCache():void [override] 
		 
		 Clears the cached dimensions for all virtualized indices.  | FlowLayout | ||
resetVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void [override] 
		 
		 Clears the cached dimensions for one specific virtualized index.  | FlowLayout | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when a property of the layout changes, indicating that a redraw is probably needed. | FlowLayout | |||
![]()  | Dispatched when the layout would like to adjust the container's scroll position. | BaseVariableVirtualLayout | ||
| firstHorizontalGap | property | 
firstHorizontalGap:Number
		 The space, in pixels, between the first and second items. If the
		 value of firstHorizontalGap is NaN, the
		 value of the horizontalGap property will be used
		 instead.
		 		 
 The default value is NaN.
    public function get firstHorizontalGap():Number    public function set firstHorizontalGap(value:Number):voidSee also
| gap | property | 
gap:Number
		 Quickly sets both horizontalGap and verticalGap
		 to the same value. The gap getter always returns the
		 value of horizontalGap, but the value of
		 verticalGap may be different.
		 		 
 The default value is 0.
    public function get gap():Number    public function set gap(value:Number):voidSee also
| horizontalAlign | property | 
horizontalAlign:StringIf the total row width is less than the bounds, the items in the row can be aligned horizontally.
Note: The HorizontalAlign.JUSTIFY
		 constant is not supported.
 The default value is feathers.layout.HorizontalAlign.LEFT.
    public function get horizontalAlign():String    public function set horizontalAlign(value:String):voidSee also
| horizontalGap | property | 
horizontalGap:NumberThe horizontal space, in pixels, between items.
 The default value is 0.
    public function get horizontalGap():Number    public function set horizontalGap(value:Number):void| lastHorizontalGap | property | 
lastHorizontalGap:Number
		 The space, in pixels, between the last and second to last items. If
		 the value of lastHorizontalGap is NaN, the
		 value of the horizontalGap property will be used instead.
		 		 
 The default value is NaN.
    public function get lastHorizontalGap():Number    public function set lastHorizontalGap(value:Number):voidSee also
| 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.
		 		 
 The default value is 0.
    public function get padding():Number    public function set padding(value:Number):voidSee also
| paddingBottom | property | 
paddingBottom:NumberThe space, in pixels, below the items.
 The default value is 0.
    public function get paddingBottom():Number    public function set paddingBottom(value:Number):void| paddingLeft | property | 
paddingLeft:NumberThe space, in pixels, to the left of the items.
 The default value is 0.
    public function get paddingLeft():Number    public function set paddingLeft(value:Number):void| paddingRight | property | 
paddingRight:NumberThe space, in pixels, to the right of the items.
 The default value is 0.
    public function get paddingRight():Number    public function set paddingRight(value:Number):void| paddingTop | property | 
paddingTop:NumberThe space, in pixels, above of items.
 The default value is 0.
    public function get paddingTop():Number    public function set paddingTop(value:Number):void| rowVerticalAlign | property | 
rowVerticalAlign:StringIf the height of an item is less than the height of a row, it can be aligned vertically.
 The default value is feathers.layout.VerticalAlign.TOP.
    public function get rowVerticalAlign():String    public function set rowVerticalAlign(value:String):voidSee also
| verticalAlign | property | 
verticalAlign:StringIf the total height of the content is less than the bounds, the content may be aligned vertically.
Note: The VerticalAlign.JUSTIFY
		 constant is not supported.
 The default value is feathers.layout.VerticalAlign.TOP.
    public function get verticalAlign():String    public function set verticalAlign(value:String):voidSee also
| verticalGap | property | 
verticalGap:NumberThe vertical space, in pixels, between items.
 The default value is 0.
    public function get verticalGap():Number    public function set verticalGap(value:Number):void| FlowLayout | () | Constructor | 
public function FlowLayout()Constructor.
| addToVariableVirtualCacheAtIndex | () | method | 
override 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) | 
| calculateNavigationDestination | () | method | 
 public function calculateNavigationDestination(items:Vector.<DisplayObject>, index:int, keyCode:uint, bounds:LayoutBoundsResult):int
		 
		 Using the current index and a key press, calculates the new index.
		 This might be use to change a list's selectedIndex when
		 a key is pressed.
		 
		 
Parameters
items:Vector.<DisplayObject> | |
index:int | |
keyCode:uint | |
bounds:LayoutBoundsResult | 
int | 
| getDropIndex | () | method | 
 public function getDropIndex(x:Number, y:Number, items:Vector.<DisplayObject>, boundsX:Number, boundsY:Number, width:Number, height:Number):intReturns the index of the item if it were dropped at the specified location.
Parameters
x:Number | |
y:Number | |
items:Vector.<DisplayObject> | |
boundsX:Number | |
boundsY:Number | |
width:Number | |
height:Number | 
int | 
| getNearestScrollPositionForIndex | () | method | 
 public function getNearestScrollPositionForIndex(index:int, scrollX:Number, scrollY:Number, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):PointCalculates the scroll position nearest to the current scroll position that will display the full bounds of the item within the view port. If the item is already fully displayed in the view port, the current scroll position will be returned unchanged.
While the item will be displayed in the view port without being
		 clipped in any way, it may not be placed in the most prominent
		 position possible. To give the item a more prominent location, use
		 getScrollPositionForIndex() instead.
This function should always be called after the
		 layout() function. The width and height arguments are
		 the final bounds of the view port, which may be calculated in the
		 layout() function.
Parameters
index:int | |
scrollX:Number | |
scrollY:Number | |
items:Vector.<DisplayObject> | |
x:Number | |
y:Number | |
width:Number | |
height:Number | |
result:Point (default = null) | 
Point | 
| 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.
Typically, this function is used to show the item in the most
		 prominent way, such as centering. To scroll a minimum distance
		 required to display the full bounds of the item in the view port,
		 use getNearestScrollPositionForIndex() instead.
This function should always be called after the
		 layout() function. The width and height arguments are
		 the final bounds of the view port, which may be calculated in the
		 layout() function.
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>
		 
		 Used internally by a component, such as List, to
		 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. Uses the
		 typical items dimensions, or cached dimensions, if available.
		 		 
This function is meant to be called by the List or
		 other component that uses the virtual layout. If you're simply
		 creating a layout for a List or another component, do
		 not call this function. It is meant for developers creating custom
		 components only.
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>, viewPortBounds: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> | |
viewPortBounds:ViewPortBounds (default = null) | |
result:LayoutBoundsResult (default = null) | 
LayoutBoundsResult | 
| measureViewPort | () | method | 
 public function measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point
		 
		 Used internally by a component, such as List, to measure
		 the view port based on the typical item dimensions or cached
		 dimensions, if available.
		 		 
This function is meant to be called by the List or
		 other component that uses the virtual layout. If you're simply
		 creating a layout for a List or another component, do
		 not call this function. It is meant for developers creating custom
		 components only.
Parameters
itemCount:int | |
viewPortBounds:ViewPortBounds (default = null) | |
result:Point (default = null) | 
Point | 
| positionDropIndicator | () | method | 
 public function positionDropIndicator(dropIndicator:DisplayObject, index:int, x:Number, y:Number, items:Vector.<DisplayObject>, width:Number, height:Number):void
		 
		 Positions the drop indicator in the layout. Must be called after
		 layout().
		 
Parameters
dropIndicator:DisplayObject | |
index:int | |
x:Number | |
y:Number | |
items:Vector.<DisplayObject> | |
width:Number | |
height:Number | 
| removeFromVariableVirtualCacheAtIndex | () | method | 
override 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 | 
override public function resetVariableVirtualCache():voidClears the cached dimensions for all virtualized indices.
| resetVariableVirtualCacheAtIndex | () | method | 
override 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 | 
starling.events.Eventstarling.events.Event.CHANGEDispatched when a property of the layout changes, indicating that a redraw is probably needed.
The properties of the event object have the following values:
| Property | Value | 
|---|---|
bubbles | false | 
currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use
	   myButton.addEventListener() to register an event listener,
	   myButton is the value of the currentTarget. | 
data | null | 
target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the
	   currentTarget property to always access the Object
	   listening for the event. |