Xml line break issue in Flash
19 May / 09
I got some xml text line break issues in my latest project. The texts look good viewing them locally, but when uploading the project to the customer server I get a lot of extra line breaks. I am not really sure why this problem occurs but I guess it has to do with the server platform. I tried to save the xml with a different encoding but with no luck so I wrote this simple method. It works.
public function fixLineBreakIssues(value : String) : String { return value.split("\r").join(""); } // usage txtField.htmlText = fixLineBreakIssues(xmlText);
Related posts:
1 comment so far
Post a comment
Please be polite and on topic. You are welcome to use HTML tags.






Hi,
this occurred to me too in projects some time ago. It turned out that it has to do with how the line endings are encoded in the textfile. Most editors (including for example FlashDevelop) have an option “CR+LF”, “CR” and “LF”. Sometimes “CR+LF” is the default and the webserver interpretes both as a new line. You have removed one of them with your code snippet so this is fine. But you could go to your text-editor and change the settings for line endings.
hope this helps,
sebastian