1 Attachment(s)
CSS in Flash via XML ... close!
Hi there,
I've managed to learn alot of steps to getting to where I've gotten, but I can't seem to get it, and I'm at a dead end. What I'm trying to do is display CSS enhanced text in flash with an XML file. The problem is that when the text is in the given text box, it's not formatted, and only the 2nd entry is posted, even though tracing it displays the text perfectly.
Here is the flash:
Code:
newsText.html = true;
newsText.wordWrap = true;
newsText.multiline = true;
newsText.label.condenseWhite=true;
newsStyle = new TextField.StyleSheet();
newsStyle.load("styles.css");
newsText.styleSheet = newsStyle;
newsContent = new XML();
newsContent.ignoreWhite = true;
newsContent.load("conglomeration.xml");
newsContent.onLoad = function(success)
{
if (success) {
var news = newsContent.firstChild.firstChild;
var newsEntries = news.childNodes;
for (var e=0; e<newsEntries.length; e++){
currEntry = newsEntries[e];
newsText.text = currEntry.firstChild.firstChild.nodeValue +" > "+ currEntry.firstChild.nextSibling.firstChild.nodeValue +"\n"+ currEntry.firstChild.nextSibling.nextSibling.firstChild.nodeValue +"\n"
}
}
}
Here is the XML:
HTML Code:
<?xml version="1.0" encoding="UTF-8" ?>
<conglomeration>
<news>
<entry>
<entrydate>Jul.18.05</entrydate>
<entrytitle>First Entry</entrytitle>
<entrybody>
<![CDATA[First news entry will go here.]]>
</entrybody>
</entry>
<entry>
<entrydate>Jul.19.05</entrydate>
<entrytitle>Second Entry</entrytitle>
<entrybody>
<![CDATA[Second news entry will go here.]]>
</entrybody>
</entry>
</news>
</conglomeration>
and here is the CSS:
Code:
entrydate {
color: #FF0000;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
display: block;
}
entrytitle {
color: #0000FF;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
display: block;
}
entrybody {
color: #000000;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
display: block;
}
I've also attached the files used.
Thanks in advance for any help :)