I'm importing text in from an xml file and i'm using htmlText to try to keep some styling with tags. I have both the regular and bold face font embedded, and the bolding works fine. The problem is that it ads spaces around the words in bold like a paragraph indent and then makes a line-break after them. What's going on, is there a way to fix?
fromxmlText.htmlText = theXML.contenttext;
If I pull the text in from a txt file it will work fine, but taking it out of an xml file causing funky formatting. lil' help?
To add HTML into XML you must use CDATA blocks otherwise the HTML is considered part of the XML document.
e.g.
<root>
<someHtml><![CDATA[I can contain<br />html tags]]></someHtml>
<somePlainText>I cannot contain html tags since they will be
seen as XML nodes</somePlainText>
</root>
Also make sure you are saving your XML files with unix line endings and encoded as utf-8. If you are using windows line endings (\r\n
) then Flash tends to double space newlines. Your editor should allow you to specify the line endings.