Getting the AS3 ScrollPane Component to automatically scroll to the bottom
Here’s my updated AS3 method that forces the ScrollPane to scroll all the way to the bottom in order to show the newest entry. It’s important to remember that there is a delay in AS3 after doing an addChild() call so this method should only be called after you can ensure your new dynamic content has been added to the ScrollPane source via an addedToStage listener or checking loop.
import fl.containers.ScrollPane;
public function updateScroller() : void
{
/*
Pre-Conditions:
1. scrollContainer is an instance of ScrollPane on the stage
2. commentContainer is a movieClip containing dynamic content on the stage
3. All Elements to be added have finished being added to commentContainer
*/
scrollContainer.source = commentContainer;
scrollContainer.update();
scrollContainer.verticalScrollPosition = scrollContainer.maxVerticalScrollPosition;
}