6 Replies Latest reply on Apr 9, 2009 7:53 AM by alice_data

    How to Move the Scroll Bar to the Bottom of the Screen

    alice_data Level 1

      Hi,

       

        I have a problem here that I hope someone on this list could help me figure it out.

       

        Here is the portion of where my textArea is at:
      <mx:TextArea id="text2" width="250" height="385"
                 borderStyle="none" text="{book_info}"/>

       

        This is the book_info variable that I use to generate info to insert into text2:

       

        book_info  += message + "\t" + message2 + "\n";
                                var splitText:Array = book_info.split("null");
                                book_info = splitText.join("");
                                trace(message  + "\t" + message2);

        text2.selectionBeginIndex = text2.length;
        text2.selectionEndIndex = text2.length;

       

        The problem is that when text start to get generated into the textarea, the text cursor is still located at the beginning and the user has to scroll down to retrieve the newly added information.

       

        The code above allows the text cursor to be at the end of the textarea, by definition text2 in this case, but I find that I still have to scroll the scrollbar to the bottom to see the new added line(s). Is it possible to append the text so that my "scrollbar" position is always at the bottom of the screen? Any pointers would be appreciated.

       

      Thanks in advance.

       

      Alice