Flash AS2.0 - Read <li> tags from XML
-
03-07-2019 - |
Question
I have an XML document, and contained within one of the nodes, I have <li>
tags. I don't need <ul></ul>
tags for Flash because it only accepts <li>
tags anyway. For example, here's part of the XML doc:
<node>
<li>item1</li>
<li>item2</li>
</node>
I want to put all the data within the <node>
tags, with bullets, into a TextArea component in Flash 8.
Note that my textArea is set to accept HTML, and that
textArea.text = "<li>This is bulleted text</li>";
works just fine. However, the <li>
tags within the XML document are being interpreted as a completely different node, which I obviously do not want.
I tried using a CDATA tag within the XML, and it inputted everything between the <node>
tags, including the <li>
tags with all their brackets. It does that because <li>
's brackets are being interpreted with the equivalent "& lt;" and "& gt;" for the left/right brackets.
So now I'm stuck with an unordered list in my XML file that I can't read into Flash. Unless, of course, somebody here can help me out?
Solution 2
I figured it out. Turns out I was throwing in .firstChild onto the end of my XML navigation string, meaning it would ignore all the extra <li>
tags. Simply remove .firstChild and it returns EVERYTHING between the nodes, meaning Flash can read the <li>
tags.
OTHER TIPS
Are you putting in the text into the htmlText-property?
// you posted:
textArea.text = "<li>This is bulleted text</li>";
// it should be:
textArea.htmlText = "<li>This is bulleted text</li>";
Also, try putting the tags in uppercase, as2 can be a bit finicky about that.