Search code examples
apache-flexactionscript-3flex4tlf

Remove line breaks from pasted text in Spark TextArea


I'm trying to remove all line breaks from the text that is pasted into the Spark TextArea.

I have: <s:TextArea id="inputSearchQuery" width="100%" height="22" minHeight="22" maxHeight="196" changing="onInputSearchQueryChanging(event)"/>

And handler:

private function onInputSearchQueryChanging(evt:TextOperationEvent = null):void {
    if (evt.operation is PasteOperation) {

    }
}

Where can I find a text that user pasted? As I understand, this text should be in evt.operation.textFlow but it is not... I'm confused.


Solution

  • Pasted text is in (evt.operation as PasteOperation).textScrap. So you can extract text from textScrap.textFlow.