Good day everyone,
I am creating a small Flash app that will get updated content from an XML
file. The XML document looks like this:
<Event>
<Data>
<visible>1</visible>
<Heading1>Heading Test</font></Heading1>
<BodyText>Body test</BodyText>
<ButtonText>Press Me</ButtonText>
<URLText>http://www.rmp-consulting.com</URLText>
</Data>
The above structure is repeated for every event.
In my Flash app, I am walking through the XML document with the following code:
while (element != null) {
if (element.nodeName.toUpperCase() == "VISIBLE") {
isVisible.push(element.firstChild.nodeValue);
}
if (element.nodeName.toUpperCase() == "HEADING1") {
heading.push(element.firstChild.nodeValue);
}
if (element.nodeName.toUpperCase() == "SUBHEADING") {
subheading.push(element.firstChild.nodeValue);
}
if (element.nodeName.toUpperCase() == "BODYTEXT") {
BodyText.push(element.firstChild.nodeValue);
}
if (element.nodeName.toUpperCase() == "BUTTONTEXT") {
ButtonText.push(element.firstChild.nodeValue);
}
if (element.nodeName.toUpperCase() == "URLTEXT") {
URLText.push(element.firstChild.nodeValue);
}
element = element.nextSibling;
}
I then set dynamic text fields using the values in the array:
this.news1.heading.text = heading[0];
this.news1.BodyText.text = BodyText[0];
this.news1.myButton.buttonText.text = ButtonText[0];
this.news1.URLText.text = URLText[0];
Ideally, I want to be able to include some basic HTML formatting option in the
XML document. I would like change the color and size. But,as as soon as I
change my XML document to include these tags, the above code does not function
correctly.
Any suggestions?
Rowan - 01 Jul 2008 21:42 GMT
Might as well reply to my own post, and provide answer...
All I need to do was wrap my HTML tags with a <!CDATA[ ... ]] tag .. works like charm.
Rowan - 01 Jul 2008 21:42 GMT
Might as well reply to my own post, and provide answer...
All I need to do was wrap my HTML tags with a <!CDATA[ ... ]] tag .. works like charm.