# Need help with this array/position problem

**URL:** <https://forum.kirupa.com/t/need-help-with-this-array-position-problem/282839>\
**Category:** flash\
**Created:** [February 27, 2009, 12:35am UTC](https://forum.kirupa.com/t/need-help-with-this-array-position-problem/282839 "2009-02-27T00:35:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [February 27, 2009, 12:35am UTC](https://forum.kirupa.com/t/need-help-with-this-array-position-problem/282839/1 "2009-02-27T00:35:07Z")

</div>

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:

```auto

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?
