Getting long string (terminated with newline) from Textarea in Flex

This simple task is not that simple. I can get the number of lines of textarea using mx: internals, but this is not always the longest line ending with a newline.

I've tried every possible textArea.text.split("\n") \r <br/> {/n ..

It always returns me length 1.

My eternal worship to everyone who can put me in the right direction.

Greg

==========

var arr:Array = texCodeArea.text.split(/\n/);
trace(arr.length);
trace("TEXT iS :", texCodeArea.text, "END"); 

      

==========

1
TEXT iS : aaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbb 
cccccc END 

      

0


a source to share


3 answers


Use / \ r / instead of / \ n /.



I do not know why; it works just like that.

+3


a source


Try:

textArea.text.split(/\n/); 

      



instead.

0


a source


DIVISION (/ \ r \ n /);

0


a source







All Articles