3 Replies Latest reply on Oct 14, 2011 9:58 PM by Shongrunden

    Make Mobile Scroller 'Spring Back' Programmatically

    pcoyne1979

      Hi, I am having a problem with the Flex 4.5 Scroller when used in a mobile application. If I set the horizontalScrollPosition/verticalScrollPosition properties to negative values programmatically, then the scroller content does not spring back automatically. Is there a method I could call on the mobile skin to make it perform the springing? I tried to dispatch a TouchInteractionEvent but it didn't work.

        • 1. Re: Make Mobile Scroller 'Spring Back' Programmatically
          Shongrunden Adobe Employee

          I don't believe there is currently an API that supports something like this.  Can you consider playing an effect on the verticalScrollPosition, for example:

           

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                         xmlns:s="library://ns.adobe.com/flex/spark">

             

              <fx:Declarations>

                  <s:Animate id="an" target="{tripList.dataGroup}" duration="500">

                      <s:motionPaths>

                          <s:SimpleMotionPath property="verticalScrollPosition" valueTo="0"/>

                      </s:motionPaths>

                      <s:easer>

                          <s:Power exponent="3" />

                      </s:easer>

                  </s:Animate>

              </fx:Declarations>

             

              <s:controlBarContent>

                  <s:Button label="set vsp" click="tripList.dataGroup.verticalScrollPosition = -100" />

                  <s:Button label="scroll back" click="an.play()" />

              </s:controlBarContent>

             

              <s:List id="tripList" width="100%" height="100%">

                  <s:dataProvider>

                      <s:ArrayList>

                          <s:source>

                              [0,1,2,3,4,5,6,7,8,9]

                          </s:source>

                      </s:ArrayList>

                  </s:dataProvider>

              </s:List>

             

          </s:Application>

          1 person found this helpful
          • 2. Re: Make Mobile Scroller 'Spring Back' Programmatically
            pcoyne1979 Level 1

            Hi, yes I tried this and also with TweenLite. It works fine but I have to put extra logic in the gesture handler which probably slows things down. It would be better if there was just a method to call to make it spring.

            • 3. Re: Make Mobile Scroller 'Spring Back' Programmatically
              Shongrunden Adobe Employee

              There currently isn't an API exposed for this.  Please vote for and/or leave a comment with your use case on this enhancement request: http://bugs.adobe.com/jira/browse/SDK-28789