2 Replies Latest reply on Jan 23, 2011 4:53 AM by sony_gg

    Finding the scrolling speed in a spark list control

    sony_gg

      Hi,

       

      I have to find the speed of scrolling in a spark List control with Tile layout. I am adding an event listener on the list.scroller.verticalScrollBar component for Event.CHANGE but this event does not seem to give any info on how much the list has scrolled. Is there any way to get that information?

       

      I see there is a ScrollEvent in flex 3 which gives you the amount of scroll. I am not sure how this is achieved in flex 4.

       

      Any help would be highly appreciated.

       

      Thanks.

        • 1. Re: Finding the scrolling speed in a spark list control
          MikisMM

          There is a MouseEvent.MOUSE_WHEEL. It has a delta property which tells how many 'clicks' the wheel was scrolled. Have in mind that the value comes from the browser or OS maybe and it is modified by those two.

           

          As for the scroll speed it depends what do you call by that name. All spark lists are scrolled by pages. In most cases one page is an item renderer in a list. So if some item rederer is 50px height, for each 'click' the list is srolled 50 px. If a scroller is used not with the list but a container, a page is only 1 px.

           

          Now to actually find out how much the container has moved inside a viewport you could listen for MOVE event on a container which actually is moved when a scroller does its work. That container in spark List, I believe, is the dataGroup part. Try attaching a handler for MOVE event on it and see if something works out. Maybe there is a better way, but I wasn't able to find any documentation regarding the issue.

           

          Anyway, this is one of the few things I find illogical and difficult to understan in Flex framework. Most of the things I've said comes after diggin in the flex code. So don't take it for granted.

           

          Michael

          • 2. Re: Finding the scrolling speed in a spark list control
            sony_gg Level 1

            Thank you very much for your help. The MOVE and MOUSE_WHEEL events did not work for me though.