Jump to content


HTML or CSS tags in XML text content

Recommended Posts



Is it possible to use HTML or CSS tags in XML text content?


here's my loader:

private function loadMp3 ():void {
LoaderMax.activate([MP3Loader, CSSLoader]);
queue1 = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler});
queue1.append( new CSSLoader("./css/flashSiteStyles.css", {name:"flashStyleSheet"}) );
queue1.append( new XMLLoader("./xml/mp3List.xml", {}));


Here's my XML:


When my load gets to the mp3Title attribute the load silently fails. If I remove the tags it loads fine. I've tried escaping the tags with CDATA but there doesn't seem to be a way to wrap the content since it's in an attribute.

Link to comment
Share on other sites

I'm pretty sure if you want html tags you will need to use a node instead of an attribute like so:





Tomorrow is Monday]]>


*note I am using chicken.mp3 and I would strongly suggest that your mp3 filename not contain any space characters.


after the XMLLoader completes you can get the mp3Title with:


function completeHandler(e:LoaderEvent):void{
       var xml:XML = LoaderMax.getLoader("track1").vars.rawXML;



read more about rawXML here: http://www.greensock.com/as/docs/tween/ ... oader.html


As a side note, if all the mp3 titles are going to display in bold, it would be much easier to just apply the boldness with actionscript.


var mp3Title:String = LoaderMax.getLoader("track1").vars.mp3Title;
titleText.htmlText = "" + mp3Title + ""  


hope 1 of those solutions is satisfactory.

Link to comment
Share on other sites

Thanks a lot, this:


       <b>Tomorrow is Monday</b>

is exactly what I had in mind.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.