views:

688

answers:

3

Hi, This somehow simple task is not so simple. I can get the number of lines of the textarea using mx:internals, but thats is not always the longest line ending by a newline.

I tried all sort of textArea.text.split("\n") \r <br/> {/n .. It always returns me the length of 1.

My eternal worshipping to anyone 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
A: 

Try:

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

instead.

CookieOfFortune
it did not work as well :/
coulix
+2  A: 

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

Not sure why; it just works that way.

le dorfier
Woot ! thanks a lot
coulix
A: 

s.split(/\r\n/);