The Dev Pages

A knowledge base for web applications development (and beyond)

Line break in Flex or Actionscript 3 text

Posted on June - 12 - 2008

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

  1. juniper Said,

    Nice Site!

Add A Comment