Scrolling to the bottom of a spark List after adding an item can be a little tricky especially when adding multiline text. This post demonstrates how to do it using a chat pod as a sample use case.
This example validates the List then tries to scroll to the end using the getVerticalScrollPositionDelta() method on the layout. Notice that there is a loop that possibly validates the List up to 10 times. This is because sometimes we may need to scroll several times in virtual layout as some items may not be loaded yet and their size is only estimated.
This loop is a little bit ugly and there is a bug filed at SDK-25740 to make this use case easier. Please vote for that issue if you would like to see that functionality implemented.
Here is an example of it in action, type in a bunch of messages and notice that the List scrolls automatically as you would expect in a typical chat pod:
Note: This sample requires Flex SDK 4.0.0 or higher. You can get the latest SDK builds from opensource.adobe.com.