This content has been marked as final.
Show 1 reply
-
1. Re: How do I style XML text with CSS?
David_MB Feb 17, 2009 11:19 AM (in response to David_MB)Nevermind I figured it out. But.......... just in case anyone wants to know this.................
Here is the code that will apply a CSS stylesheet called "viewerData.css" to a text field called "list1" who's content is loaded from a XML file called "viewerData.xml" Basically this allows me to load a list of names into a text field with hyperlinks attached to them.
--------------------------------
var css:StyleSheet;
var cssLoader:URLLoader = new URLLoader();
cssLoader.load(new URLRequest("viewer_data/viewerData.css"));
cssLoader.addEventListener(Event.COMPLETE, processCSS);
function processCSS(e:Event):void {
//trace("stuff");
}
var dataXML:XML;
var XMLLoader:URLLoader = new URLLoader();
XMLLoader.load(new URLRequest("viewer_data/viewerData.xml"));
XMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void {
dataXML = new XML(e.target.data);
var linkData:String = dataXML.nameList;
this.list1.styleSheet = css;
this.list1.htmlText = linkData;
}
--------------------------------------------

