Scroll automatically to the bottom of spark TextArea

来源:互联网 发布:淘宝指数关键词 编辑:程序博客网 时间:2024/06/13 04:46

转载:http://www.smithfox.com/?e=172

 

[备忘] Scroll automatically to the bottom of spark TextArea

Use appendText function, spark TextArea will automatically scroll to bottom.

If you use TextArea.textFlow.addChild(xx), you should add some code:

1. write a function:

private function textAreaScrollToBottom(event:Event):void {
trace("textAreaScrollToBottom");
textArea.scroller.verticalScrollBar.value = textArea.scroller.verticalScrollBar.maxHeight;
//textArea.scroller.verticalScrollBar.validateNow();
}

2. listen TextArea.updateComplete event, and invoke textAreaScrollToBottom()

3. listen TextArean.textFlow.updateComplete event, and invoke  textAreaScrollToBottom()

Yes, you must listen both TextArea.updateComplete and TextArean.textFlow.updateComplete!!

 

原创粉丝点击