7

I have a component extending a Spark List, and when I scroll using the mouse wheel it scrolls too much in one go. I have tried looking for the handler that deals with mouse wheel scrolling in the List class and VerticalLayout class to override but I cannot find it.

Is there another way I'm supposed to change this, or am I missing something?

zero323
  • 322,348
  • 103
  • 959
  • 935
Heather Roberts
  • 1,978
  • 1
  • 24
  • 33
  • If your problem is only with me mousewheel: I've the same problem and still no solution :( http://stackoverflow.com/questions/3584127/scrolling-interval-in-a-spark-list-with-tilelayout-oversized-while-using-mouse-wh – hering Mar 07 '11 at 13:44
  • yeah its just mouse wheel scrolling, it moves about 3 times as much as normal scrolling and so looks inconsistent. otherwise its fine... Using the mx list I could do override protected function mouseWheelHandler() to change the speed, so I assumed there'd be something the same in the spark list... – Heather Roberts Mar 07 '11 at 14:44

2 Answers2

11

The "delta" property of MouseEvent.MOUSE_WHEEL defines how many lines will be scrolled by one wheel-scrolling. You could try changing it in the MOUSE_WHEEL handler (during capture phase). For example the following code will scroll line-by-line:

        protected function init(event:FlexEvent):void
        {
            list.addEventListener(MouseEvent.MOUSE_WHEEL, list_mouseWheelHandler, true);
        }

        protected function list_mouseWheelHandler(event:MouseEvent):void
        {
            event.delta = event.delta > 0 ? 1 : -1;
        }

Maria Sakharova
  • 1,389
  • 15
  • 15
  • I already tried that, the handler gets called too late so it has no effect on the scrolling, but thanks anyway :) What I want to know is which function to override that the list is calling when it hears MouseEvent.MOUSE_WHEEL – Heather Roberts Mar 08 '11 at 13:30
  • 1
    You have added handler with capture set to false. If you add handler with capture set to true -> it will be called earlier. This will solve your problem, and you don't need to override anything. As for the hadler: check VScrollBar->mouseWheelHandler (but honestly, you don't need to override it). Once again, try to subscribe the MOUSE_WHEEL event exactly as in the example above. – Maria Sakharova Mar 08 '11 at 13:44
  • Thank you! that really did solve the problem, sorry i didn't notice yesterday. the true was off the screen so i thought it was what i tried already... thank you very much :) – Heather Roberts Mar 09 '11 at 09:13
  • And on what component should I capture the mouse event? – Florian F Jun 09 '15 at 14:48
0

The "horizontalLineScrollSize" and "verticalLineScrollSize" properties determine how many pixels to scroll when the user selects the scroll bar arrows. The "verticalLineScrollSize" property also controls the amount of scrolling when using the "mouse wheel". The default value is 5 pixels. The "horizontalPageScrollSize" and "verticalPageScrollSize" properties determine how many pixels to scroll when the user selects the "scroll bar track". The default value is 20 pixels.

More details: http://livedocs.adobe.com/flex/3/html/help.html?content=containers_intro_4.html

karora
  • 33
  • 6