2 Replies Latest reply on Dec 7, 2009 7:44 AM by radikalFish

    scroll wheel delta

    radikalFish Level 1

      Hello

       

      I'm trying without success to adapt the scrolling amount each time the wheel is turned one unit.

       

      the setup is just a simple custom ContentDataList skin implementation where the container is defined like that:

       

      <s:Scroller id="scroller" top="0" bottom="0" left="0" right="0" minViewportInset="20" focusEnabled="true">
              <s:DataGroup id="dataGroup" >
                  <s:layout>
                      <s:VerticalLayout horizontalAlign="justify" variableRowHeight="true" gap="0"/>
                  </s:layout>
              </s:DataGroup>
          </s:Scroller>

       

       

      so the mouseEvent delta returns every time 3.

      i've found that the actual mouse wheel handler is inside Scroller.as

      there it uses the viewports (DataGroup in my case) getVerticalScrollPositionDelta methode to compute the height.

       

      Since my dataProvider for the dataGroup are items with text, image etc., each item is quit height..

       

      it scrolls 3 item heights (at least 3 times the height of the first item in the dataProvider)

      which is actually pretty too height for my needs

       

      the IViewport's implementation getVerticalScrollPositionDelta methode uses the LayoutBase getVerticalScrollPositionDelta

      but i have no idea how to change that....

       

      i tried to define a typicalItem for my VerticalLayout (i used the Skin label for that) with the intention that the LayoutBase getVerticalScrollPositionDelta will than return that height...

      but this doesn't seem to work...

       

      Seems that I'm missing something here...

       

      Waiting for enlightening...

       

      radicalFish

        • 1. Re: scroll wheel delta
          David_F57 Level 5

          Hi,

           

          I assume that you are using windows, the mouse scroll of 3 lines is the windows default (3 lines per roll click, 3 lines per tilt click). You can adjust this in the windows control panel, as this would certainly not be a great thing for uniformity maybe overriding the delta behaviour by checking the delta value and adjusting things accordingly would be the trick.

           

           

          David..

          1 person found this helpful
          • 2. Re: scroll wheel delta
            radikalFish Level 1

            Hi, thx for answering..

             

            yes, actually i need a os configuration independed behavior...

             

            anyway i can't figure out how override this behavoir when i keep using the Scroller comp.

             

            Scroller adds the the scrollWheel event handler inside it's attachSkin methode:

             

            //inside Scroller.as

            override protected function attachSkin():void
                {
                    super.attachSkin();
                    Group(skin).layout = new ScrollerLayout();
                    installViewport();
                   skin.addEventListener(MouseEvent.MOUSE_WHEEL, skin_mouseWheelHandler);
                }

             

            and the " skin_mouseWheelHandler" is a private methode...

             

            if i create a new class extended from Scroller i would need to call super.attachSkin inside an overridden attachSkin function..

            so it would add the unwanted handler anyway

             

            i would need to call the super.super.attachSkin without the call to Scroller.attachSkin..

            i don't think it's possible...

             

            still missing something i guess...

             

            would perhaps be easier to add the scrollbars (it viewport and behavoir) to my comp skin without the spark.Scroller

             

            r.Fish