1 Reply Latest reply on Aug 21, 2010 9:31 AM by supersonicecho

    Textarea Scroll Position

    Whitetimer Level 1

      Hi All

       

      I have a textarea that is populated with text dynamically.  The text is larger than the component and so i get the scrollbars appear.  When i go to view another page in the viewstack and then return to the previous page with the textarea, the scoll position does not reset to 0 ...

       

      So how do i do this in flex 4 ?

       

      Many Thanks

        • 1. Re: Textarea Scroll Position
          supersonicecho Level 2

          For a flex 4, spark textarea, to reset the scroll position:

           

          textAreaInstanceName.scroller.verticalScrollBar.value = 0;  (for a vertical scroll bar)

          OR

          textAreaInstanceName.scroller.horizontalScrollBar.value = 0;  (for a horizontal scroll bar)

           

          Listen for the change event on the viewStack, and reset the scroll position as needed. E.G.something like =>

           

          viewStackInstance.addEventListener('change', function(e):void {
               if(e.newIndex == 1) textAreaInstanceName.scroller.verticalScrollBar.value = 0; 
          });