Hi,
I'm looking for help writing an algorithm in a filter function I am using.
Here's the situation: Based on a page number and a number of records per page,
I want to return all indexes that fall within a certain range. There are 4
records per page.
For example;
- page 1 will return indexes 0-4
- page 2 will return indexes 5 - 9
- page 3 will return indexes 10 - 14
....etc, etc...
So, here are the vars:
var index:int = myCollection.getItemIndex( item );
var recordsPerPage:int = 4;
It's embarrassing, but this is what I have so far....
if( page <= index < (page * page + recordsPerPage) )
return true
Can anyone offer some helpful insight, please?
Thank you for any help.