1 Reply Latest reply on Oct 30, 2009 9:10 AM by David_F57

    Mouse Down and Mouse Move  and scroll ?




      Here is what I want to do:


      Whenever a user presses the mouse down and the moves the mouse, I want to synchronize the scrollbar thumb and the mouse. How is it possible?



        • 1. Re: Mouse Down and Mouse Move  and scroll ?
          David_F57 Level 5



          there are 2 ways to do this depending on what you need from the mouse move


          1. To get the difference from when the mouse is pressed


          on the mousedown event your store the mouse coordinates -


          myX=   stageX   or LocalX    myY=  stageY  or LocalY 


          on the mousemove event you subtract the current co-ordinates from the saved cordinates


          myXDif = myX-currentX

          myYDif = myY-currentY


          the difference will be negative or positive you can use that figure to calculate the percentage of range and then set the scrollposition


          2. Just track the mouse



          on the mouse move calculate the percentage position of the mouse to set the scrollbars

          HorizontalScrollPostion= the Max horizontal value * (LocalX /Width)

          VerticalScrollPosition= the max vertical value * (LocalY/Height)