1 Reply Latest reply on May 21, 2010 5:23 PM by Peter Flynn (Adobe)

    Scroll and States: Back to initial state

    rafael zum

      Hi guys.

      I'm making a presentation that contains some states with scrollbars. When i navigate between them, i see the scroll thumb when it was last time i was in the state.

      Is there a way to make the scroll get back to top of the page everytime i get into it?

      Thanks!

        • 1. Re: Scroll and States: Back to initial state
          Peter Flynn (Adobe) Adobe Employee

          Hi Rafael,

           

          The scrollbar position normally won't change as the user navigates between states (assuming it's really the same scrollbar, shared across those states).  I don't know of any way in Catalyst to force the scroll position to reset when you visit a certain state, but this is easy to do with a snippet of code when you're ready to take the project into Flash Builder.

           

          For a list, just add this code to reset the scroll to the top:

             listId.ensureIndexIsVisible(0);

           

          For a scroll panel, use this:

             scrollPanelId.contentGroup.verticalScrollPosition = 0;

           

          In both cases, if the tag representing the list/scrollpanel doesn't have an id="..." attribute, you'll need to add one so you can refer to it in your code.

           

          - Peter