Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 将flex spark scroller修改为按页面滚动,并使用_Actionscript 3_Apache Flex_Flex4.5_Flex Spark - Fatal编程技术网

Actionscript 3 将flex spark scroller修改为按页面滚动,并使用

Actionscript 3 将flex spark scroller修改为按页面滚动,并使用,actionscript-3,apache-flex,flex4.5,flex-spark,Actionscript 3,Apache Flex,Flex4.5,Flex Spark,我根据Steven Shongrunden的优秀文章修改了我的VScrollBar的滚动条外观,因此只有上下按钮,没有滚动条 现在我想修改滚动条的行为,使其每次点击滚动一页。更好的是,我想让滚动动画轻松,也就是说,不从一页跳到另一页,但滚动动画 ScrollBarBase的文档提出了许多方法,这些方法应该提供实现这一点的方法,但我找不到任何关于如何使用这些优秀方法和属性的示例: animatePaging(newValue:Number, pageSize:Number): Animate

我根据Steven Shongrunden的优秀文章修改了我的VScrollBar的滚动条外观,因此只有上下按钮,没有滚动条

现在我想修改滚动条的行为,使其每次点击滚动一页。更好的是,我想让滚动动画轻松,也就是说,不从一页跳到另一页,但滚动动画

ScrollBarBase的文档提出了许多方法,这些方法应该提供实现这一点的方法,但我找不到任何关于如何使用这些优秀方法和属性的示例:

animatePaging(newValue:Number, pageSize:Number): 
  Animates the operation to move to newValue.

button_buttonDownHandler(event:Event): 
  Handles a click on the increment or decrement button      

button_buttonUpHandler(event:Event): 
  Handles releasing the increment or decrement button

decrementButton:Button
  An optional skin part that defines a button that, when pressed, steps the scrollbar up.

incrementButton:Button
  An optional skin part that defines a button that, when pressed, steps the scrollbar down.
我的直觉是,我需要中断递减按钮和递增按钮的按钮/向下处理程序,并调用animatePaging,但我真的不知道如何做到这一点。尽管已经编写了大量AS3并成功修改了不少皮肤,但这些spark皮肤对我来说仍然很神秘

期待有任何见解


谢谢

我找到了问题的答案

我需要扩展VScrollBar类。一旦我这样做了,就很容易覆盖button\u buttonDown/UpHandler

扩展了VScrollBar类之后,在我的皮肤中,我替换了

<my_namespace:CustomVScrollBar for  <s:VScrollBar
package my_package {

    import flash.events.Event;
    import gs.TweenLite;
    import spark.components.VScrollBar;



    public class CustomVScrollBarextends VScrollBar
    {

        public function CustomVScrollBar()
        {
            super();
        }



        override protected function button_buttonDownHandler(event:Event):void {
            var valueTo:Number;
            if (event.target == incrementButton) {
                valueTo = Math.min(value+pageSize, maximum);
            } else if (event.target == decrementButton) {
                valueTo = Math.max(value-pageSize, minimum);
            }
            if (! isNaN(valueTo)) {
                TweenLite.to(this.viewport, .75, {verticalScrollPosition: valueTo});
            }
        }

        override protected function button_buttonUpHandler(event:Event):void {
            // 
            // nothing
        }

    }
}