1 Reply Latest reply on Aug 6, 2006 7:03 AM by kglad

    scroll math not working just right

    Vertine
      hi - i have a bunch of boxes inside a main box(mainFrame). The bunch of boxes are stacked vertically. I am trying to make the boxes scroll up/down with a scrollbar. you can see the demo here.

      What i want to know is have i approached this all wrong? My concept was to get the height of the mainFrame mc, get the height of the scrollbar, get the ratio (mainFrame._height/scrllbar._height) of these two...then with setInterval, i would track the placement of the dragger(to the scrollbar height) and multiply that back to the ratio to reflect the size of mainFrame:

      any ideas?
        • 1. Re: scroll math not working just right
          kglad Adobe Community Professional & MVP
          with all scrollbar draggers (whether they are vertical or horizontal or something else) and all objects that will be scrolled (whether they are vertical or horizontal or something else) , you can assume that there will be 2 extreme positions of the scrollbar dragger and 2 extreme positions of the object being controlled and you can assume a linear equation will be used to give the position of the object depending upon the position of the scrollbar dragger.

          so, in your situation of a vertical dragger and vertical movieclip:

          mc._y=a*dragger._y+b; // where you solve for a and b using the two equations that result from knowing the 2 extreme dragger positions and the two corresponding extreme movieclip positions.