Newline characters not recognized when parsing external XML file
I encountered this problem when implementing a workaround for the multiline unicode text wrapping bug. I use newline characters (”\n”) to break up the text manually. When I load the XML file and parse it in my Flex app, newline characters are displayed in the text field. Tracing out the string displays “\n” and not an escaped version like “\\n”. Oddly enough this simple replace fixes the problem:
var myText : String = String( root.somenode.anothernode );
myText = myText.replace(/\\n/g, "\n");
About this entry
You’re currently reading “Newline characters not recognized when parsing external XML file,” an entry on Rozengain.com - New Media Development Blog
- Published:
- 08.13.08 / 10am
- Category:
- ActionScript, Flash, Flex

1 Comment
Jump to comment form | comments rss [?] | trackback uri [?]