2 Replies Latest reply on Feb 13, 2011 9:50 PM by Shongrunden

    flex masters please help, spark list a big problem of scroll

    sunny chandel Level 1

      i have list control in flex 4, when i add items to it i want the scroll to reach the maximum vertical scroll position. the list has a renderer.

       

      For this I have used:
      list.layout.verticalScrollPosition = list.dataGroup.contentHeight - list.dataGroup.height;

       

      The problem is that i want to show the max vertical scroll position as soon as the item is added to the list. So i have used in code:
      arrCollection.addItem(myObject);
      list.layout.verticalScrollPosition = list.dataGroup.contentHeight - list.dataGroup.height;

       

      These two operation one after the other does not solve the problem so i used callLater (two times) for setting verticalScrollPosition like:
      callLater(function laterSetVerticalScroll():void
      {
      callLater(function laterSetVerticalScroll():void
      {
      list.layout.verticalScrollPosition = list.dataGroup.contentHeight - list.dataGroup.height;

       

      });
      });

       

      DUE TO THIS LATER CALL THE SCROLL SHOWS A FLICKER (like it goes to vertical scroll 0, and then this method is called later), a very bad looking flicker on each additem.

       

      I have already used list.ensureIndexIsVisible(arrColl.length - 1), this doesnt help either.

       

      Please suggest a solution. Thanks