Flex 4 和 ScrollBar 步长

发布于 2024-08-14 11:17:40 字数 160 浏览 13 评论 0原文

我想指定使用 VScrollBar 滚动的量。 所以在 Flex 3 中我们有“lineScrollSize”,但是这个属性在 Flex 4 中如何调用呢? 我认为它是 VScolBar.stepSize — 但它没有做任何事情。

有人请帮助我。 我只是希望我的内容在鼠标滚轮上滚动得更快。

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.stepSize — but it dose not do anything.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一袭水袖舞倾城 2024-08-21 11:17:40

查看 LayoutBase.getVerticalScrollPositionDelta。您可能想要子类化并覆盖它!

这是我在自己的布局类中所做的:

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;
}

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;
}
绅士风度i 2024-08-21 11:17:40

这里有一个如何增加 mouseWheel 滚动的步长的示例:
http://forums.adobe.com/message/2783736

您应该能够取消 mouseWheel 滚动使用此增强功能会更容易一些:
http://bugs.adobe.com/jira/browse/SDK-26432

与该错误相关的子任务有一个简单的代码示例,您应该能够修改该示例以防止鼠标滚轮滚动并调用缩放逻辑:

<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>

此线程中的讨论也可能对您有用:
http://forums.adobe.com/message/3393852#3393852

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

-黛色若梦 2024-08-21 11:17:40

我想出了一个解决方法,需要子类化/扩展滚动条的皮肤。

这样,您只需使用自定义滚动条,而不是修改滚动条内的每个视口,

我将其放在 Flex SDK bug 的注释中,显然不应该以

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文