5 Replies Latest reply on Feb 20, 2009 8:01 PM by

    override protected function scrollDown()

      Hello all,

      When I try to "override protected function scrollDown()" on my mx:Application container, it says "incompatible override".

      The help docs say that to override a protected function you must implement it similarly with the same parameters and return result.

      How do I find the details of this function so I can implement it properly?

      cheers
        • 1. Re: override protected function scrollDown()
          Level 7
          The public and private method signatures are listed in the API docs for
          the class. I'm not sure where you came up with the function
          scrollDown(), but it doesn't seem to be a public or private method for
          the Application class.

          http://livedocs.adobe.com/flex/3/langref/mx/core/Application.html
          1 person found this helpful
          • 2. Re: override protected function scrollDown()
            slight moment of insanity, I had a var named scrollDown so the function was conflicting...

            I'm trying to find the function that gets called when the scrollbar up/down buttons are clicked - so that I can override them.

            How would I find this?
            • 3. Re: override protected function scrollDown()
              levancho Level 3
              you subscribe to ScrollEvent
              quote:


              yourcontainer.addEventListener(ScrollEvent. SCROLL, yourFunc);


              @see http://livedocs.adobe.com/flex/3/langref/mx/events/ScrollEvent.html
              • 4. Re: override protected function scrollDown()
                Thanks levancho - seems I'm getting closer..

                When I add that listener my function gets called whenever there's a click on either arrow or the scrollbar itself which is not quite what I'm after.

                I tried adding the following method to creationComplete of the Canvas container:

                private function init(e:Event):void{
                var target:Canvas = e.currentTarget as Canvas;
                var scroller:VScrollBar = target.verticalScrollBar as VScrollBar;
                scroller.mx_internal::downArrow.addEventListener(MouseEvent.CLICK, scrollDown);
                }

                but I get a null object reference trying to assign the 'verticalScrollBar' to 'scroller'

                When I drill down from the canvas using a breakpoint I can see that downArrow/upArrow are listed but I can't seem to get to them.

                • 5. Re: override protected function scrollDown()
                  Yeah ok - major brain fade.

                  It was that simple - thanks for your help.


                  if(e.direction == "vertical" && e.detail == "lineDown") {
                  scrollDown(e.currentTarget as Canvas);
                  }else if (e.direction == "vertical" && e.detail == "lineUp") {
                  scrollUp(e.currentTarget as Canvas);
                  }
                  }

                  private function scrollDown(target:Canvas):void{
                  animateScroll.fromValue = target.verticalScrollPosition;
                  animateScroll.toValue = target.verticalScrollPosition + contentStack.height;
                  animateScroll.play([target]);
                  }

                  private function scrollUp(target:Canvas):void{
                  animateScroll.fromValue = target.verticalScrollPosition;
                  animateScroll.toValue = target.verticalScrollPosition - contentStack.height;
                  animateScroll.play([target]);
                  }