开发者

Flex 4 and ScrollBar stepSize

开发者 https://www.devze.com 2022-12-14 07:46 出处:网络
I want to specify amount to scroll with VScrollBar. So in Flex 3 we have \"lineScrollSize\" but how this property called in Flex 4?

I want to specify amount to scroll with VScrollBar. So in Flex 3 we have "lineScrollSize" but how this property called in Flex 4? I thought it VScrolBar.stepSi开发者_如何转开发ze — but it dose not do anything.

Somebody please help me. I just whant my content to scroll faster on mouse wheel.


Have a look into LayoutBase.getVerticalScrollPositionDelta. You might want to subclass and override it!

Here's what I did in my own layout class:

override public function getVerticalScrollPositionDelta(navigationUnit:uint):Number {
    var n:Number=super.getVerticalScrollPositionDelta(navigationUnit);
    if (navigationUnit==NavigationUnit.DOWN || navigationUnit==NavigationUnit.UP) return 10*n;
    return n;
}


There is an example of how to increase the stepSize for mouseWheel scrolling here: http://forums.adobe.com/message/2783736

You should be able to cancel mouseWheel scrolling a little easier with this enhancement: http://bugs.adobe.com/jira/browse/SDK-26432

The sub-task linked to that bug has a simple code sample that you should be able to modify to prevent mouse wheel scrolling and call your zooming logic instead:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark"> 
    <fx:Script> 
        <![CDATA[ 
            ...
            private function mouseWheelChangingHandler(event:FlexMouseEvent):void { 
                // don't scroll by preventing default
                event.preventDefault(); 

                // instead zoom
                yourZoomFunction(event.delta);
            } 
        ]]> 
    </fx:Script> 

    <s:Scroller id="scroller" width="250" height="200" mouseWheelChanging="mouseWheelChangingHandler(event)"> 
        <s:DataGroup id="vp" dataProvider="{getDP()}" itemRenderer="spark.skins.spark.DefaultItemRenderer"> 
            <s:layout> 
                <s:VerticalLayout gap="0" horizontalAlign="justify" /> 
            </s:layout> 
        </s:DataGroup> 
    </s:Scroller>
</s:Application>

The discussion in this thread might also be useful to you: http://forums.adobe.com/message/3393852#3393852


I've come up with a workaround, which requires subclassing/extending the skins of the scrollbars.

This way you only have to use a custom scroller, rather then modify each viewport inside the scroller

I put it in the comment on the Flex SDK bug, which clearly should not have been ignored to begin with

https://bugs.adobe.com/jira/browse/SDK-17288

0

精彩评论

暂无评论...
验证码 换一张
取 消