I'm trying to create a seemingly simple component that uses two
buttons (left and right) to scroll through the list as opposed to
using the scrollbars. What I've built so far is a custom list class
that implements a next and previous method to call the lists
scrolltoindex() method to update the items displayed in the list. This
works somewhat well except for two issues:

1) When scrolling to the end of the list, there is a blank space shown
as an extra item instead of stopping on the last item in the list.

2) When scrolling backwards using the previous method, if trying to
scroll to an index that is less than 0, the list throws a compiler
error. I have worked around this by checking for this case in the
previous method and overriding the index with 0; however, this appears
to be something that is already being handled by the list itself (my
list is extending TileBase) so I'm wondering if I'm doing something
wrong here.

The basic methods i'm using:

public function next():void
{
  _index = _index + columnCount;
  moveToIndex();
}
                
public function previous():void
{
  _index = _index - columnCount > 0 ? _index - _offset : 0;
  moveToIndex();
}

private function moveToIndex():void
{
  scrollToIndex( _index  );
}

As always, any input is greatly appreciated!

Reply via email to