This content has been marked as final. Show 8 replies
If you want to use html-tags you need to place the text in a CDATA section.
I had already tried the following line in one of my child nodes, but it does not work.
<text>Go to the <![CDATA[ <a href="/index.html">;top page</a> ]]>.</text>
the result is the same as if I place html tags within the child node string, that the string gets truncated after it reaches the "<" sign at the beginning of the CDATA tag, or this shows up in my dynamic text field:
Go to the
I have ensured that my dynamic text field has the "Render Text as HTML" enabled (small button with "<>" on it), but to no avail.
Any other thoughts?
Are you using the htmlText property of the text field?
Yes, if you mean if I have pressed that little button with the "<>" on it in the properties of the text field, yes. also, when I load the text string with actonscript (from an array), I use:
this.stillImageContainer.stillImageDescription.stillImageDescriptionText. htmlText = stillsDesc i;
The same problem persists -- everything that falls within the CDATA tags does not get read into my stillsDesc i variable.
the (breviated) entry of my XML file that contains the link looks like this (<text> is the XML tag):
<text>Go to the <![CDATA[ <a href="/index.html">;top page</a>]]>.</text>
the string variable I am trying to load into my array in Flash is "Go to the top page." where "top page" is the hyperlink.
On my way into work, I thought that maybe there needs to be some definition witin the header of my XML file that enables CDATA to work. The header I use now is:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
Which, I believe, is the standard. Do I need a later version?
Going insane in the membrane, here.
Thanks for the help thus far -- it is appreciated.
How about putting all of the html inside the CDATA, not just part of it?
That was it - sort of... It renders out correctly in my Dynamic Text Field, in any case, but with two strange things:
(1) the hotspot for the link is not only within the area taken by the underlined linked words, it appears to be the entire length of the hyperlinked words plus the area underneath it all the way to the bottom boundary of the dynamic text field.
(2) -- I will post this in a new thread -- the link works fine and dandy when tested within Flash. but, as soon as it is embedded in HTML and read in through a browswer, the link does nothing. I can click forever but, alas, my link does not open.
you can also replace the < and > with < and >
flash will read this as the < or > signs and it will not affect your xml and you don't need the CDATA tags.
OK. I feel weird contradicting the other posters on here but you do not necessarily need to place your HMTL code inside the CDATA section to get them to work properly. I used to do that and then I found that if I defined a StyleSheet with starting XML tag then it was much simpler. For example:
Then my XML file might look like this:
<?xml version="1.0" encoding="UTF-8"?>
<text>Mack Trucks of North America came to us to help them create marketing <b><a href ="www.blah.blah">materials</a></b> for their MP7 Diesel Engine.
Then in Flash I would read in both the XML and CSS files into appropriate variables and then assign them to my TextField. Assume my dynamic TextField is named: tf, that I read in the CSS file into a variable named "css" and the XML file into a variable named "myxml". Then I would use the following code:
tf.wordWrap = true;
tf.multiline = true;
tf.embedFonts = true;
tf.html = true;
tf.styleSheet = css; // see help docs on reading in CSS from an external file.
tf.htmlText = myxml.firstChild.firstChild; // This will bring to the <text> tag in the above XML
This would then render as:
Mack Trucks of North America came to us to help them create marketing materials for their MP7 Diesel Engine.
Just thought I would throw this out to everyone.