PDA

View Full Version : TileList.scrollToIndex



rondog
February 26th, 2009, 05:18 PM
I cant get the scrollToIndex function to work. I have two arrows going left and right for my next and previous buttons.

My tilelist is vertical and only shows one item at a time. I am not getting an errors or anything, it just doesnt scroll. Here is how I initiate my tile list:


private function initSpec(e:Event):void
{
this.removeEventListener(Event.ADDED_TO_STAGE, initSpec);
holder = (this.parent as MovieClip).specSheetHolder;

tileList = new TileList();

for (var i:int = 1; i <= pages; i++)
{

tileList.addItem({source:["pages/page" + i + ".swf"]});

}

tileList.columnWidth = 850;
tileList.rowHeight = 1200;
tileList.columnCount = 1;
tileList.rowCount = 1;
tileList.height = stage.stageHeight;
tileList.width = stage.stageWidth;

tileList.scrollPolicy = ScrollPolicy.ON;
tileList.direction = ScrollBarDirection.VERTICAL;

holder.addChild(tileList);
}


and then this calls the scrollToIndex:


private function setPageNum():void
{

pageText.text = currentPage + " / " + totalPages;
tileList.scrollToIndex(currentPage);

}


any idea?

rondog
February 26th, 2009, 06:17 PM
ok i've discovered that if I change the rowHeight property so that one item is entirely visible (having rowheight set as 1200 clipped the first item), it works. The problem now is that my swf's are scaled to small now and you cant read them.

This is probably the stupidest thing I've ever seen. Can anyone think of a work around??