views:

131

answers:

2

I am trying to use html elements to style text inside an XML file that is loaded and displayed by flash. When I do this the text will not display at all. Here is a chunck of my XML :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Page>
    <Title>You should be <b>Bold</b> ! </Title>
<Page>

When I try the code below, it displays but ignores the b tags:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Page>
    <Title>You should be &lt;b&gt;Bold&lt;/b&gt; ! </Title>
<Page>

Here is the actionscript that sets the dynamic text field:

Container.Title.htmlText = xmlData.Title[0];

From what I can tell, this should be entirely doable. Tutorials and reference online gives no hist to the problem. Seems simple but its driving me nuts. Any help would be greatly appreciated.

+2  A: 

Try wrapping the HTML in CDATA tags, like so:

<![CDATA[ -- your html content here -- ]]>
inkedmn
This didn't work. with the CDATA tags, the text was displayed but the tags ignored when I used <b> (previously didn't display at all), when I did <b> it displayed as <b>. Any other ideas?
Armitage
A: 

Have you tried just HTML encoding the HTML and then seeing if the actionscript handles it appropriately? You might have to decode it in actionscript, not sure.

Kevin M
I have encoded it in my 2nd code block. It ignores the tags and shows the text without styling. It's as if there is no default css for b or strong or em.
Armitage