I have a scroll pane component with SWFs loaded in them vertically like a PDF viewer. I need to be able to change the page indicator when the user scrolls.
I have an event listener on the scroll pane listening for scroll.
I have an array of the Y values of each page; looks something like this:
0,800,1600,2400,3200 etc
What kind of equation would I do to determine the correct number.
My scroll event looks like this:
private function checkYValue(e:ScrollEvent):void
{
var currentY:Number = (e.position + PAGE_SPACING) / PAGE_SPACING;
/* traces out these kind of values
1.05
1.055
1.06
1.065
1.07
*/
}
currentY is obviously the Y position of the scroller in pixels starting from 0.
So with that said, how could I change the page number based off of currentY?