Packagefeathers.layout
Classpublic class VerticalLayout
InheritanceVerticalLayout Inheritance EventDispatcher Inheritance Object
Implements IVariableVirtualLayout, ITrimmedVirtualLayout

Positions items from top to bottom in a single column.

See also

http://wiki.starling-framework.org/feathers/vertical-layout


Public Properties
 PropertyDefined By
  afterVirtualizedItemCount : int
The number of virtualized items that appear after the items passed to layout().
VerticalLayout
  beforeVirtualizedItemCount : int
The number of virtualized items that appear before the items passed to layout().
VerticalLayout
  gap : Number
THe space, in pixels, between items.
VerticalLayout
  hasVariableItemDimensions : Boolean
When the layout is virtualized, and this value is true, the items may have variable width values.
VerticalLayout
  horizontalAlign : String
The alignment of the items horizontally, on the x-axis.
VerticalLayout
  padding : Number
Quickly sets all padding properties to the same value.
VerticalLayout
  paddingBottom : Number
The space, in pixels, that appears on the bottom, after the last item.
VerticalLayout
  paddingLeft : Number
The minimum space, in pixels, to the left of the items.
VerticalLayout
  paddingRight : Number
The minimum space, in pixels, to the right of the items.
VerticalLayout
  paddingTop : Number
The space, in pixels, that appears on top, before the first item.
VerticalLayout
  scrollPositionVerticalAlign : String
When the scroll position is calculated for an item, an attempt will be made to align the item to this position.
VerticalLayout
  typicalItemHeight : Number
The height, in pixels, of a "typical" item that is used to virtually fill in blanks for the layout.
VerticalLayout
  typicalItemWidth : Number
The width, in pixels, of a "typical" item that is used to virtually fill in blanks for the layout.
VerticalLayout
  useVirtualLayout : Boolean
Determines if virtual layout can be used.
VerticalLayout
  verticalAlign : String
If the total item height is less than the bounds, the positions of the items can be aligned vertically.
VerticalLayout
Public Methods
 MethodDefined By
  
Constructor.
VerticalLayout
 Inherited
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.
VerticalLayout
 Inherited
dispatchEvent(event:Event):void
Dispatches an event to all objects that have registered listeners for its type.
EventDispatcher
 Inherited
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.
VerticalLayout
  
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.
VerticalLayout
 Inherited
hasEventListener(type:String):Boolean
Returns if there are listeners registered for a certain event type.
EventDispatcher
  
layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult
Positions (and possibly resizes) the supplied items within the optional bounds argument.
VerticalLayout
  
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.
VerticalLayout
 Inherited
removeEventListener(type:String, listener:Function):void
Removes an event listener from the object.
EventDispatcher
 Inherited
removeEventListeners(type:String = null):void
Removes all event listeners with a certain type, or all of them if type is null.
EventDispatcher
  
Removes an item in to the cache at the specified index, moving the values at following indexes down by one.
VerticalLayout
  
Clears the cached dimensions for all virtualized indices.
VerticalLayout
  
resetVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void
Clears the cached dimensions for one specific virtualized index.
VerticalLayout
Events
 Event Summary Defined By
  VerticalLayout
Public Constants
 ConstantDefined By
  HORIZONTAL_ALIGN_CENTER : String = center
[static] The items will be aligned to the center of the bounds.
VerticalLayout
  HORIZONTAL_ALIGN_JUSTIFY : String = justify
[static] The items will fill the width of the bounds.
VerticalLayout
  HORIZONTAL_ALIGN_LEFT : String = left
[static] The items will be aligned to the left of the bounds.
VerticalLayout
  HORIZONTAL_ALIGN_RIGHT : String = right
[static] The items will be aligned to the right of the bounds.
VerticalLayout
  VERTICAL_ALIGN_BOTTOM : String = bottom
[static] If the total item height is smaller than the height of the bounds, the items will be aligned to the bottom.
VerticalLayout
  VERTICAL_ALIGN_MIDDLE : String = middle
[static] If the total item height is smaller than the height of the bounds, the items will be aligned to the middle.
VerticalLayout
  VERTICAL_ALIGN_TOP : String = top
[static] If the total item height is smaller than the height of the bounds, the items will be aligned to the top.
VerticalLayout
Property Detail
afterVirtualizedItemCountproperty
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.


Implementation
    public function get afterVirtualizedItemCount():int
    public function set afterVirtualizedItemCount(value:int):void
beforeVirtualizedItemCountproperty 
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.


Implementation
    public function get beforeVirtualizedItemCount():int
    public function set beforeVirtualizedItemCount(value:int):void
gapproperty 
gap:Number

THe space, in pixels, between items.


Implementation
    public function get gap():Number
    public function set gap(value:Number):void
hasVariableItemDimensionsproperty 
hasVariableItemDimensions:Boolean

When the layout is virtualized, and this value is true, the items may have variable width values. If false, the items will all share the same width value with the typical item.


Implementation
    public function get hasVariableItemDimensions():Boolean
    public function set hasVariableItemDimensions(value:Boolean):void
horizontalAlignproperty 
horizontalAlign:String

The alignment of the items horizontally, on the x-axis.


Implementation
    public function get horizontalAlign():String
    public function set horizontalAlign(value:String):void
paddingproperty 
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.


Implementation
    public function get padding():Number
    public function set padding(value:Number):void
paddingBottomproperty 
paddingBottom:Number

The space, in pixels, that appears on the bottom, after the last item.


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

The minimum space, in pixels, to the left of the items.


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

The minimum space, in pixels, to the right of the items.


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

The space, in pixels, that appears on top, before the first item.


Implementation
    public function get paddingTop():Number
    public function set paddingTop(value:Number):void
scrollPositionVerticalAlignproperty 
scrollPositionVerticalAlign:String

When the scroll position is calculated for an item, an attempt will be made to align the item to this position.


Implementation
    public function get scrollPositionVerticalAlign():String
    public function set scrollPositionVerticalAlign(value:String):void
typicalItemHeightproperty 
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.


Implementation
    public function get typicalItemHeight():Number
    public function set typicalItemHeight(value:Number):void
typicalItemWidthproperty 
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.


Implementation
    public function get typicalItemWidth():Number
    public function set typicalItemWidth(value:Number):void
useVirtualLayoutproperty 
useVirtualLayout:Boolean

Determines if virtual layout can be used. Some components don't support virtual layouts. In those cases, the virtual layout options will be ignored.


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

If the total item height is less than the bounds, the positions of the items can be aligned vertically.


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

Constructor.

Method Detail
addToVariableVirtualCacheAtIndex()method
public function 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.

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):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.

Parameters

index:int
 
items:Vector.<DisplayObject>
 
x:Number
 
y:Number
 
width:Number
 
height:Number
 
result:Point (default = null)

Returns
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)

Returns
Vector.<int>
layout()method 
public function layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult

Positions (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)

Returns
LayoutBoundsResult
measureViewPort()method 
public function 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.

Parameters

itemCount:int
 
viewPortBounds:ViewPortBounds (default = null)
 
result:Point (default = null)

Returns
Point
removeFromVariableVirtualCacheAtIndex()method 
public function removeFromVariableVirtualCacheAtIndex(index:int):void

Removes 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():void

Clears the cached dimensions for all virtualized indices.

resetVariableVirtualCacheAtIndex()method 
public function resetVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void

Clears the cached dimensions for one specific virtualized index.

Parameters

index:int
 
item:DisplayObject (default = null)

Event Detail
change Event
Event Object Type: starling.events.Event

Constant Detail
HORIZONTAL_ALIGN_CENTERConstant
public static const HORIZONTAL_ALIGN_CENTER:String = center

The items will be aligned to the center of the bounds.

HORIZONTAL_ALIGN_JUSTIFYConstant 
public static const HORIZONTAL_ALIGN_JUSTIFY:String = justify

The items will fill the width of the bounds.

HORIZONTAL_ALIGN_LEFTConstant 
public static const HORIZONTAL_ALIGN_LEFT:String = left

The items will be aligned to the left of the bounds.

HORIZONTAL_ALIGN_RIGHTConstant 
public static const HORIZONTAL_ALIGN_RIGHT:String = right

The items will be aligned to the right of the bounds.

VERTICAL_ALIGN_BOTTOMConstant 
public static const VERTICAL_ALIGN_BOTTOM:String = bottom

If the total item height is smaller than the height of the bounds, the items will be aligned to the bottom.

VERTICAL_ALIGN_MIDDLEConstant 
public static const VERTICAL_ALIGN_MIDDLE:String = middle

If the total item height is smaller than the height of the bounds, the items will be aligned to the middle.

VERTICAL_ALIGN_TOPConstant 
public static const VERTICAL_ALIGN_TOP:String = top

If the total item height is smaller than the height of the bounds, the items will be aligned to the top.