Flex Spark List Mouse Wheel Scroll Speed

China☆狼群 提交于 2019-12-22 04:48:17

问题


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?


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/5220371/flex-spark-list-mouse-wheel-scroll-speed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!