Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do I style XML text with CSS?

Explorer ,
Feb 17, 2009 Feb 17, 2009
How do I load a CSS stylesheet to format XML text that is loaded into the swf using AS3? The goal is to assign hyperlinks to a list of text. The only way I can find to do that is CSS formatted XML. However, there is very, very little information on how to load and apply CSS to XML text using AS3.

Anyone know how to do this?
TOPICS
ActionScript
397
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 17, 2009 Feb 17, 2009
LATEST
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;

}

--------------------------------------------
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines