2 Replies Latest reply on Apr 28, 2011 10:33 PM by AntiFreez

    How to change Scroller velocity?

    AntiFreez Level 1

      I'm trying to scroll BorderContainer with a spark Scroller:

       

      <s:Scroller id="scroller" width="100" height="100">

             <s:Group id="container">

                   <s:layout>

                         <s:HorizontalLayout horizontalAlign="center" useVirtualLayout="true"/>

                   </s:layout>

       

                   <s:BorderContainer>

                         // Other components here

                   </s:BorderContainer>

               </s:Group>

      </s:Scroller>

       

       

      But the scroll delta in this case equals 1px !!! Therefore, i have tried to change

       

      scroller.verticalScrollBar.pageSize = 10; and/or scroller.verticalScrollBar.stepSize = 10;

       

      but this doesn't work...

       

      Any ideas?

        • 1. Re: How to change Scroller velocity?
          Lee Burrows Level 4

          not sure if theres a better way, but when i want more control over scrollbars i dont use a scroller. i would do this:

           

           

          <s:Group id="container" clipAndEnableScrolling="true">

                       <s:layout>

                             <s:HorizontalLayout horizontalAlign="center" useVirtualLayout="true"/>

                       </s:layout>

           

                       <s:BorderContainer>

                             // Other components here

                       </s:BorderContainer>

                   </s:Group>

           

          <s:HScrollBar viewport="{container}" ... />

          <s:VScrollBar viewport="{container}" ... />

           

          you'll need to position the scrollbars yourself by doing it this way but now you should be able to adjust pageSize etc

          1 person found this helpful
          • 2. Re: How to change Scroller velocity?
            AntiFreez Level 1

            Thanks for your answer! While learning your example, i have found answer =)

             

            <s:Scroller id="scroller" width="100%" height="0">

                 <s:Group width="100%" height="100%">

                      <s:layout>

                           <s:VerticalLayout verticalAlign="middle" horizontalAlign="center"/>

                      </s:layout>

                      <s:Group width="100%" height="100%">

                           <s:Rect id="backGround" width="100%" height="100%">

                                <s:fill>

                                     <s:SolidColor color="#EEEEEE"/>

                                </s:fill>

                           </s:Rect>

                           <s:Group id="container" width="100%" height="100%">

                                <s:layout>

                                      <s:VerticalLayout verticalAlign="middle" horizontalAlign="center"/>

                                </s:layout>

                            </s:Group>

                       </s:Group>

                  </s:Group>

             

            </s:Scroller>

             

             

            If viewport of scroller have VerticalLayout the scoll velocity by height becomes normal!

            If viewport of scroller have HorizontalLayout the scoll velocity by with becomes normal!