Packagefeathers.layout
Classpublic class MultiColumnGridLayout
InheritanceMultiColumnGridLayout Inheritance EventDispatcher Inheritance Object
Implements ILayout

Positions items in rows following a grid with a specific number of columns, defaulting to 12 columns. Automatically flows from row to row.

See also

http://wiki.starling-framework.org/feathers/multi-column-grid-layout
MultiColumnGridLayoutData


Public Properties
 PropertyDefined By
  columnCount : int
The number of columns in the grid.
MultiColumnGridLayout
  columnGap : Number
The size, in pixels, of the gap between columns.
MultiColumnGridLayout
  rowGap : Number
The size, in pixels, of the gap between rows.
MultiColumnGridLayout
Public Methods
 MethodDefined By
  
Constructor.
MultiColumnGridLayout
 Inherited
addEventListener(type:String, listener:Function):void
Registers an event listener at a certain object.
EventDispatcher
 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.
MultiColumnGridLayout
 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.
MultiColumnGridLayout
 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
Property Detail
columnCountproperty
columnCount:int

The number of columns in the grid.


Implementation
    public function get columnCount():int
    public function set columnCount(value:int):void
columnGapproperty 
columnGap:Number

The size, in pixels, of the gap between columns.


Implementation
    public function get columnGap():Number
    public function set columnGap(value:Number):void
rowGapproperty 
rowGap:Number

The size, in pixels, of the gap between rows.


Implementation
    public function get rowGap():Number
    public function set rowGap(value:Number):void
Constructor Detail
MultiColumnGridLayout()Constructor
public function MultiColumnGridLayout()

Constructor.

Method Detail
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
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