I tried TextOperationEvent ton both TextArea and TextArea.textFlow
instances, but this doesn't help... This event seems to not being fired
Le 25/03/2011 21:22, Codeflayer a écrit :
I'm just shooting in the dark here but maybe you could listen for the TextOperationEvent and force the text area to scroll to the bottom?
Inspired from a similar solution for a List component, I do :
public final function scrollToBottom():void
verticalScrollBar.value = verticalScrollBar.maximum;
Called twice :
- On CompositionCompleteEvent.COMPOSITION_COMPLETE of the textFlow component
- And at the end of the function where I do textFlow.addChild(...)
It works relatively well
Here's the basic code. It does have limitations.
<s:TextArea id="fooText" width="200" height="200" valueCommit="fooText.scroller.verticalScrollBar.value = fooText.scroller.verticalScrollBar.maximum" />
You will notice in my updated example, setting the verticalScrollPolicy to "auto", does not move the TextArea up.
Message was edited by: DeanLoganBH - added link to updated blog post and view source