0 Replies Latest reply on Dec 17, 2011 4:30 PM by Sharon Hanlon

    Scrolling an image in a scroller container by dragging mouse

    Sharon Hanlon Level 1

      I have an image inside a group with a scroller.  When the image is larger than the scroller size, I get the scrollbars and can pan the image as desired.

       

      I have listeners that create and resize a rubber-band box as the user clicks on the image and drags the mouse over it.  That's working fine.

       

      What I want to add is an automatic, smooth scroll, so as the mouse is being dragged over the image, it begins to scroll as the mouse approaches the edges of the scroll area, and will continue to scroll smoothly until the edge of the image has been reached, or the user moves the mouse back.

       

      This is how my components are set up:

       

      <s:Scroller id="sourceScroller" width="450" height="500">

           <s:Group id="sourceScrollerGroup" horizontalScrollPosition="0" verticalScrollPosition="0">

                <s:Image id="sourceBitmap" mouseDown="_mouseDownListener(event)" mouseUp="_mouseUpListener(event)" />

           </s:Group>

      </s:Scroller>

       

      The image source is loaded dynamically.

       

      My tests have involved changing the value of the sourceScrollerGroup.horizontalScrollPosition and .verticalScrollPosition, but that had no effect.  I'm not sure how to proceed.  Would appreciate any pointers in the right direction.