YUI Flash Component Documentation | All Packages | All Classes | Index | Frames No Frames |
Class TileLayout

Package | com.yahoo.astra.layout.modes
Class | public class TileLayout
Inheritance | TileLayout BaseLayoutMode flash.events.EventDispatcher
Implements | IAdvancedLayoutMode

Arranges a DisplayObjectContainer's children using a tiling algorithm. All tiles are the same size and tile dimensions are determined from the maximum width or height values of the available children.

Example
The following code configures a TileLayout instance and passes it to a container:

      var tile:TileLayout = new TileLayout();
      tile.direction = "horizontal";
      tile.horizontalGap = 1;
      tile.verticalGap = 4;
      tile.horizontalAlign = HorizontalAlignment.CENTER;
      tile.verticalAlign = VerticalAlignment.MIDDLE;

      var container:LayoutContainer = new LayoutContainer();
      container.layoutMode = tile;
      this.addChild( container );

Advanced Client Options:

Optional client configuration parameters allow a developer to specify behaviors for individual children of the target container. To set these advanced options, one must call `addClient()` on the TileLayout instance and pass the child to configure along with an object specifying the configuration parameters. The following client parameters are available to the TileLayout algorithm:

`includeInLayout` : Boolean
  If `false`, the target will not be included in layout calculations. The default value is `true`.

See also

com.yahoo.astra.layout.LayoutContainer

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined by
--- | --- | ---
|  | direction : String The direction in which children of the target are laid out. | TileLayout
|  | horizontalAlign : String The children of the target may be aligned horizontally within their respective tiles. | TileLayout
|  | horizontalGap : Number The number of pixels appearing between the target's children horizontally. | TileLayout
|  | paddingBottom : Number The number of pixels displayed at the bottom of the target's children. | BaseLayoutMode
|  | paddingLeft : Number The number of pixels displayed at the left of the target's children. | BaseLayoutMode
|  | paddingRight : Number The number of pixels displayed at the right of the target's children. | BaseLayoutMode
|  | paddingTop : Number The number of pixels displayed at the top of the target's children. | BaseLayoutMode
|  | tileHeight : Number The height of tiles displayed in the target. | TileLayout
|  | tileWidth : Number The width of tiles displayed in the target. | TileLayout
|  | verticalAlign : String The children of the target may be aligned vertically within their respective tiles. | TileLayout
|  | verticalGap : Number The number of pixels appearing between the target's children vertically. | TileLayout

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined by
--- | --- | ---
|  | TileLayout() Constructor. | TileLayout
|  | addClient(target:DisplayObject, configuration:Object = null):void Registers a specific display object with the layout algorithm. | BaseLayoutMode
|  | hasClient(target:DisplayObject):Boolean Returns true if a display object has been registered as a client. | BaseLayoutMode
|  | layoutObjects(displayObjects:Array, bounds:Rectangle):Rectangle The DisplayObjects in the input parameter will be positioned and sized based on a specified rectangle. | TileLayout
|  | removeClient(target:DisplayObject):void Unregisters a specific display object from the layout algorithm. | BaseLayoutMode

Property detail

direction | property

`direction:String` [read-write]

The direction in which children of the target are laid out. Once the edge of the container is reached, the children will begin appearing on the next row or column. Valid direction values include `"vertical"` or `"horizontal"`.

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

horizontalAlign | property |

`horizontalAlign:String` [read-write]

The children of the target may be aligned horizontally within their respective tiles.

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

See also

HorizontalAlignment

horizontalGap | property |

`horizontalGap:Number` [read-write]

The number of pixels appearing between the target's children horizontally.

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

tileHeight | property |

`tileHeight:Number` [read-write]

The height of tiles displayed in the target. If NaN, the tile height will be calculated based on the maximum height among the target's children.

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

tileWidth | property |

`tileWidth:Number` [read-write]

The width of tiles displayed in the target. If NaN, the tile width will be calculated based on the maximum width among the target's children.

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

verticalAlign | property |

`verticalAlign:String` [read-write]

The children of the target may be aligned vertically within their respective tiles.

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

See also

VerticalAlignment

verticalGap | property |

`verticalGap:Number` [read-write]

The number of pixels appearing between the target's children vertically.

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

TileLayout | () | constructor

`public function TileLayout()`

Constructor.

Method detail

layoutObjects | () | method

`public override function layoutObjects(displayObjects:Array, bounds:Rectangle):Rectangle`

The DisplayObjects in the input parameter will be positioned and sized based on a specified rectangle. There is no requirement that the display objects remain entirely within the rectangle.

Returns the actual rectangular region in which the laid out children will appear. This may be larger or smaller than the suggested rectangle. This returned value is expected to be used by container components to determine if scrollbars or other navigation controls are needed.

Parameters

| `displayObjects:Array` — An Array of DisplayObjects to be laid out.
| `bounds:Rectangle` — The rectangular region in which the display objects should be placed.

Returns

| `Rectangle` — The actual region in which the display objects are contained.