0 Replies Latest reply on May 30, 2011 2:23 AM by nuniv3k

    How to interrupt the scrolling of a List (using an IconItemRenderer) ?

    nuniv3k

      Hi all !

       

      Here's the point: in a ViewNavigatorApplication, I've got a List component that uses an IconItemRenderer, and I want the user to be able to automatically reposition the list in order to show the current selected item by clicking (or should I say tapping) a button.

       

      I've managed to do so, but the problem is that when the list is scrolling, the position in the list is not updated, thus I'd like to interrupt the scrolling before updating the position in the list.

       

      Here is a (simplified) sample of my method:

       

      protected function showSelectedItem():void
                  {
                      var index:int = myList.selectedIndex;
                      if( index < 0 ) return;

                      // --> interrupt scrolling here !
                      myList.ensureIndexIsVisible(index);
                  }

       

      Bonus question: Is there a way to put an effect such as when "ensureIndexIsVisible" is called the list automatically scrolls to the good position ?

       

      Thanks in advance.