GODPAPER | All Packages | All Classes | Index | Frames No Frames |
TiledRowsLayout

Package | feathers.layout
Class | public class TiledRowsLayout
Inheritance | TiledRowsLayout EventDispatcher Object
Implements | IVirtualLayout

Positions items as tiles (equal width and height) from left to right in multiple rows. Constrained to the suggested width, the tiled rows layout will change in height as the number of items increases or decreases.

See also

http://wiki.starling-framework.org/feathers/tiled-rows-layout

Public Properties

| Property | Defined By
--- | --- | ---
|  | gap : Number Quickly sets both horizontalGap and verticalGap to the same value. | TiledRowsLayout
|  | horizontalAlign : String If the total row width is less than the bounds, the items in the row can be aligned horizontally. | TiledRowsLayout
|  | horizontalGap : Number The horizontal space, in pixels, between tiles. | TiledRowsLayout
|  | padding : Number Quickly sets all padding properties to the same value. | TiledRowsLayout
|  | paddingBottom : Number The space, in pixels, below the items. | TiledRowsLayout
|  | paddingLeft : Number The space, in pixels, to the left of the items. | TiledRowsLayout
|  | paddingRight : Number The space, in pixels, to the right of the items. | TiledRowsLayout
|  | paddingTop : Number The space, in pixels, above of items. | TiledRowsLayout
|  | paging : String If the total combined height of the rows is larger than the height of the view port, the layout will be split into pages where each page is filled with the maximum number of rows that may be displayed without cutting off any items. | TiledRowsLayout
|  | tileHorizontalAlign : String If the item's width is less than the tile bounds, the position of the item can be aligned horizontally. | TiledRowsLayout
|  | tileVerticalAlign : String If an item's height is less than the tile bounds, the position of the item can be aligned vertically. | TiledRowsLayout
|  | typicalItemHeight : Number The height, in pixels, of a "typical" item that is used to virtually fill in blanks for the layout. | TiledRowsLayout
|  | typicalItemWidth : Number The width, in pixels, of a "typical" item that is used to virtually fill in blanks for the layout. | TiledRowsLayout
|  | useSquareTiles : Boolean Determines if the tiles must be square or if their width and height may have different values. | TiledRowsLayout
|  | useVirtualLayout : Boolean Determines if virtual layout can be used. | TiledRowsLayout
|  | verticalAlign : String If the total column height is less than the bounds, the items in the column can be aligned vertically. | TiledRowsLayout
|  | verticalGap : Number The vertical space, in pixels, between tiles. | TiledRowsLayout

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | TiledRowsLayout() Constructor. | TiledRowsLayout
|  | addEventListener(type:String, listener:Function):void Registers an event listener at a certain object. | EventDispatcher
|  | 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. | TiledRowsLayout
|  | 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. | TiledRowsLayout
|  | 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. | TiledRowsLayout
|  | 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. | TiledRowsLayout
|  | 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

Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | change |  | TiledRowsLayout

Public Constants

| 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. | TiledRowsLayout
|  | 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. | TiledRowsLayout
|  | 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. | TiledRowsLayout
|  | PAGING_HORIZONTAL : String = horizontal [static] The items will be positioned in pages horizontally from left to right. | TiledRowsLayout
|  | PAGING_NONE : String = none [static] The items will not be paged. | TiledRowsLayout
|  | PAGING_VERTICAL : String = vertical [static] The items will be positioned in pages vertically from top to bottom. | TiledRowsLayout
|  | TILE_HORIZONTAL_ALIGN_CENTER : String = center [static] If an item width is smaller than the width of a tile, the item will be aligned to the center of the tile. | TiledRowsLayout
|  | TILE_HORIZONTAL_ALIGN_JUSTIFY : String = justify [static] The item will be resized to fit the width of the tile. | TiledRowsLayout
|  | TILE_HORIZONTAL_ALIGN_LEFT : String = left [static] If an item width is smaller than the width of a tile, the item will be aligned to the left edge of the tile. | TiledRowsLayout
|  | TILE_HORIZONTAL_ALIGN_RIGHT : String = right [static] If an item width is smaller than the width of a tile, the item will be aligned to the right edge of the tile. | TiledRowsLayout
|  | TILE_VERTICAL_ALIGN_BOTTOM : String = bottom [static] If an item height is smaller than the height of a tile, the item will be aligned to the bottom edge of the tile. | TiledRowsLayout
|  | TILE_VERTICAL_ALIGN_JUSTIFY : String = justify [static] The item will be resized to fit the height of the tile. | TiledRowsLayout
|  | TILE_VERTICAL_ALIGN_MIDDLE : String = middle [static] If an item height is smaller than the height of a tile, the item will be aligned to the middle of the tile. | TiledRowsLayout
|  | TILE_VERTICAL_ALIGN_TOP : String = top [static] If an item height is smaller than the height of a tile, the item will be aligned to the top edge of the tile. | TiledRowsLayout
|  | 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. | TiledRowsLayout
|  | 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. | TiledRowsLayout
|  | 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. | TiledRowsLayout

Property Detail

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.

Implementation
`public function get gap():Number`
`public function set gap(value:Number):void`

horizontalAlign | property |

`horizontalAlign:String`

If the total row width is less than the bounds, the items in the row can be aligned horizontally.

Implementation
`public function get horizontalAlign():String`
`public function set horizontalAlign(value:String):void`

horizontalGap | property |

`horizontalGap:Number`

The horizontal space, in pixels, between tiles.

Implementation
`public function get horizontalGap():Number`
`public function set horizontalGap(value:Number):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.

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

paddingBottom | property |

`paddingBottom:Number`

The space, in pixels, below the items.

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

paddingLeft | property |

`paddingLeft:Number`

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

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

paddingRight | property |

`paddingRight:Number`

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

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

paddingTop | property |

`paddingTop:Number`

The space, in pixels, above of items.

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

paging | property |

`paging:String`

If the total combined height of the rows is larger than the height of the view port, the layout will be split into pages where each page is filled with the maximum number of rows that may be displayed without cutting off any items.

Implementation
`public function get paging():String`
`public function set paging(value:String):void`

tileHorizontalAlign | property |

`tileHorizontalAlign:String`

If the item's width is less than the tile bounds, the position of the item can be aligned horizontally.

Implementation
`public function get tileHorizontalAlign():String`
`public function set tileHorizontalAlign(value:String):void`

tileVerticalAlign | property |

`tileVerticalAlign:String`

If an item's height is less than the tile bounds, the position of the item can be aligned vertically.

Implementation
`public function get tileVerticalAlign():String`
`public function set tileVerticalAlign(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.

Implementation
`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.

Implementation
`public function get typicalItemWidth():Number`
`public function set typicalItemWidth(value:Number):void`

useSquareTiles | property |

`useSquareTiles:Boolean`

Determines if the tiles must be square or if their width and height may have different values.

Implementation
`public function get useSquareTiles():Boolean`
`public function set useSquareTiles(value:Boolean):void`

useVirtualLayout | property |

`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`

verticalAlign | property |

`verticalAlign:String`

If the total column height is less than the bounds, the items in the column can be aligned vertically.

Implementation
`public function get verticalAlign():String`
`public function set verticalAlign(value:String):void`

verticalGap | property |

`verticalGap:Number`

The vertical space, in pixels, between tiles.

Implementation
`public function get verticalGap():Number`
`public function set verticalGap(value:Number):void`
Constructor Detail

TiledRowsLayout | () | Constructor

`public function TiledRowsLayout()`

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`

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`

Event Detail

change | Event

Event Object Type: `starling.events.Event`

Constant Detail

HORIZONTAL_ALIGN_CENTER | Constant

`public static const HORIZONTAL_ALIGN_CENTER:String = center`

If 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 = left`

If 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 = right`

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

PAGING_HORIZONTAL | Constant |

`public static const PAGING_HORIZONTAL:String = horizontal`

The items will be positioned in pages horizontally from left to right.

PAGING_NONE | Constant |

`public static const PAGING_NONE:String = none`

The items will not be paged. In other words, they will be positioned in a continuous set of rows without gaps.

PAGING_VERTICAL | Constant |

`public static const PAGING_VERTICAL:String = vertical`

The items will be positioned in pages vertically from top to bottom.

TILE_HORIZONTAL_ALIGN_CENTER | Constant |

`public static const TILE_HORIZONTAL_ALIGN_CENTER:String = center`

If an item width is smaller than the width of a tile, the item will be aligned to the center of the tile.

TILE_HORIZONTAL_ALIGN_JUSTIFY | Constant |

`public static const TILE_HORIZONTAL_ALIGN_JUSTIFY:String = justify`

The item will be resized to fit the width of the tile.

TILE_HORIZONTAL_ALIGN_LEFT | Constant |

`public static const TILE_HORIZONTAL_ALIGN_LEFT:String = left`

If an item width is smaller than the width of a tile, the item will be aligned to the left edge of the tile.

TILE_HORIZONTAL_ALIGN_RIGHT | Constant |

`public static const TILE_HORIZONTAL_ALIGN_RIGHT:String = right`

If an item width is smaller than the width of a tile, the item will be aligned to the right edge of the tile.

TILE_VERTICAL_ALIGN_BOTTOM | Constant |

`public static const TILE_VERTICAL_ALIGN_BOTTOM:String = bottom`

If an item height is smaller than the height of a tile, the item will be aligned to the bottom edge of the tile.

TILE_VERTICAL_ALIGN_JUSTIFY | Constant |

`public static const TILE_VERTICAL_ALIGN_JUSTIFY:String = justify`

The item will be resized to fit the height of the tile.

TILE_VERTICAL_ALIGN_MIDDLE | Constant |

`public static const TILE_VERTICAL_ALIGN_MIDDLE:String = middle`

If an item height is smaller than the height of a tile, the item will be aligned to the middle of the tile.

TILE_VERTICAL_ALIGN_TOP | Constant |

`public static const TILE_VERTICAL_ALIGN_TOP:String = top`

If an item height is smaller than the height of a tile, the item will be aligned to the top edge of the tile.

VERTICAL_ALIGN_BOTTOM | Constant |

`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_MIDDLE | Constant |

`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_TOP | Constant |

`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.

Thu Jan 16 2014, 01:11 PM +08:00