« Flex Goodness: enterDebugger() | ^ Main | How do you measure success? »


Flex 2: TextArea and line breaks

Well, this was a pain. The clients site is 100% complete and has code replacing \r with <br< and what happens? Flex rears an issue that I wasn’t expecting. Oh…the CMS is built in Flex (and looks pretty nice too).

Flex 2’s TextArea “uses UNIX-style line endings.” (read more here, towards the bottom) What does this mean for you the user? Well, several things. For starters, any text with Windows-style line endings will show extra line breaks.

To make it easier on everyone else, here is what the above link states:

*   The TextArea control uses UNIX-style line endings, which means that text data containing Windows-style carriage-return line-feed (that is, \r\n) formatting for new lines contain extra line breaks. You can use String.replace() with a regular expression to convert the text to UNIX-style line endings, as the following example shows:

    private static const windowsCRLF:RegExp = /\r\n/gm; 

    ... 

    myTextString = myTextString.replace(windowsCRLF, "\n"); 

This irritated me for a few but now I’m off to the desktop once more to fix this issue and move on with the development of this app. :-)

Posted by John C. Bland II on September 11, 2006 11:16 PM |

TrackBack

TrackBack URL for this entry:
http://mt.katapultmedia.com/mt-tb.cgi/213

Comments


hyfwaor uhfnzmd ajmt dgon kptej nsyhd hvfy

Posted by: rolaz kxzofgcs | August 23, 2007 7:43 PM

Post a comment