Sunday, May 2, 2010

Dynamically change height of TileList

You have to adjust rowCount of Tile List to make height according to data at runtime. In below example if column count is 1 you rowCount="data.length()". Now data can be XML children.length() or array.length or any data length.

[mx:TileList id="_videoList" rowCount="{data.length()}" updateComplete="changeHeight"]

You can also updateComplete if you have column count more than 1.

private function chanegHeight():void{
var rc:int = Math.ceil(data.length() / _videoList.columnCount);
if (_videoList.rowCount!=rc) _videoList.rowCount = rc;
}

Cheers,
Nehul

No comments: