Revision: 42744
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 10, 2011 02:24 by mcorlan
Initial Code
public class LiquidTileList extends TileList { /** * if true, when changing the size of the tiles * scrolls the list so the first tile from the previous * state is still visible */ public var keepVisibleItem:Boolean; public function LiquidTileList() { super(); setSkin(PictureCellRenderer); } /** * Overriding the draw method to inject * our method of calculating the number of * tiles that fit the screen * This method is called every time the width/height * is changed */ override protected function draw():void { var i:int; if (keepVisibleItem && firstVisibleItem) i = firstVisibleItem.index; scrollIndexVisible(0, 0); calculateColumns(); super.draw(); if (keepVisibleItem && i) scrollIndexVisible(i, 0); } /** * Calculates the number of tiles that fit * the width */ private function calculateColumns():void { var columnNumber:int = Math.floor( (width - (cellPadding * columnCount -1) ) / columnWidth); if (columnNumber != columnCount) columnCount = columnNumber; } }
Initial URL
Initial Description
Initial Title
Extending the QNX TileList component to create a liquid layout
Initial Tags
actionscript, 3
Initial Language
ActionScript 3