Search code examples
apache-flexdatagridflex4flex-spark

Changing the scrolling amount of a spark DataGrid when using the mouse wheel


Basically what the title says. I checked DataGridSkin, and it has a Scroller skin part, but I can't find any attribute for the scrolling amount. I might have missed it. Can anybody please help me on this issue? Thanks.


Solution

  • I found a solution: I used the idea described above, but instead of creating a class that extends VScrollBar, I added a MouseWheelChanging event listener to the scroll bar in the Scroller skin:

    <fx:Component id="verticalScrollBarFactory">
            <s:VScrollBar visible="false" mouseWheelChanging="outerDocument.vScrollBarWheelChanging(event)"/>
        </fx:Component>
    
    internal function vScrollBarWheelChanging(event:MouseEvent):void
        { event.delta/=Math.abs(event.delta); }
    

    You can set event.delta to the desired scroll amount.