Flex Spark 列表鼠标滚轮滚动速度 [英] Flex Spark List Mouse Wheel Scroll Speed
问题描述
我有一个扩展 Spark List 的组件,当我使用鼠标滚轮滚动时,它一次性滚动太多.我已经尝试在 List 类和 VerticalLayout 类中寻找处理鼠标滚轮滚动的处理程序来覆盖,但我找不到它.
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?
推荐答案
MouseEvent.MOUSE_WHEEL 的delta"属性定义了一个滚轮将滚动多少行.您可以尝试在 MOUSE_WHEEL 处理程序中更改它(在捕获阶段).例如,以下代码将逐行滚动:
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;
}
这篇关于Flex Spark 列表鼠标滚轮滚动速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!