views:

20

answers:

1

I have DataGroup with TileLayout. How to make datagroup resize accordingly to number of elements in datagroup?

For example 1 have 1 row with 4 elements. Each element is 20 pixels tall. So I want my datagroup to be 20 pixels tall as well. If I have 7 elements which will be 2 rows I want my datagroup to be 40 pixels tall and so on.

Right now for datagroup with 1 row is about 100px tall.

A: 

Found workaround:

private function onCreationComplete(event:Event):void
{
    dataGroup.height = (dataGroup.layout as TileLayout).rowCount * ((dataGroup.layout as TileLayout).rowHeight + (dataGroup.layout as TileLayout).verticalGap);
}
zdmytriv