Andy Jacobs
Andy Jacobs

Reputation: 15245

AS3 Input Textfield get text formated with \n for every new line

I have a textfield where the user can type what ever he want into it. When the user is ready typing he can hit the send button. when he does that i get the text from the multiline textfield and pass it to my backend. there is only 1 problem the text is formated in 1 single line, (html text is no option!) is it possible to set after every line a \n character?

Upvotes: 0

Views: 11788

Answers (1)

Andy Jacobs
Andy Jacobs

Reputation: 15245

var st : String ="";
for (var i:int = 0; i < tf.numLines; i++) {

            var s:String = tf.getLineText(i) + "\n";
            st += s;
}

does the trick

Upvotes: 1

Related Questions