Line break in Flex or Actionscript 3 text

Displaying a newline in a UI component in flex was a bit tricky.

The following would not work:

somevar:String = “Here is line 1 text \n followed by line 2 text”;

 

The following worked in my situation.

somevar:String = ‘Here is line 1 text’ + ‘\n’ + ‘followed by line 2 text’;

If all else fails you can use a more explicit directive, i.e. use {‘\n’} intead of \n

http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=2&postId=9223

One thought on “Line break in Flex or Actionscript 3 text”

Leave a Reply

Your email address will not be published.