Css/xml issues - hopefully an easy fix

I’ve been playing with this all day - I’ve managed to apply CSS to a textfield, and managed to get my XML formatted correctly in the text field … however … i can’t get my XML formatted correctly WITH the CSS applied. What am I doing wrong?

Here is my AS:


var news_styles = new TextField.StyleSheet();
news_styles.setStyle("title", {
  color:'#000000',
  fontSize:'12',
  display:'block'
});
news_styles.setStyle("date", {
  color:'#000000',
  fontSize:'18',
  display:'block',
  fontWeight:'bold'
});
news_styles.setStyle("message", {
  color:'#666666',
  fontWeight:'bold',
  fontStyle:'italic',
  display:'inline'
});
news_styles.setStyle("a:link", {
  color:'#FF0000'
});
news_styles.setStyle("a:hover", {
  textDecoration:'underline'
});

news_txt.styleSheet = news_styles;
//news_txt.text = storyText;


var newsXML:XML = new XML();
newsXML.ignoreWhite = true;
newsXML.load("newsxml.xml");
news_txt.autoSize = true;
//var xml_styles = new TextField.StyleSheet();
newsXML.onLoad = function(success) {
	if (success) {
		var newsBits:Number = newsXML.firstChild.childNodes.length;
		var node = newsXML.firstChild.childNodes;
		for (var i = 0; i<newsBits; i++) {
			news_txt.text += node*.childNodes[0].firstChild.nodeValue + " > ";
			news_txt.text += node*.childNodes[1].firstChild.nodeValue + newline;
			news_txt.text += node*.childNodes[2].firstChild.nodeValue + newline + newline;
		}
	}
};

and here is my XML (it’s actually a PHP file, but it gets extracted as follows:)


<?xml version="1.0"?>
<site><news>
<title>A new hat!</title>
<date>2005-10-12</date>
<message>I bought a new hat today. It's red and blue and purple and house.</message>
</news>
<news>
<title>Begin</title>
<date>2005-10-09</date>
<message>This is the first post!</message>
</news>
</site>

Thanks :slight_smile: