# Formatting xml with css

**URL:** <https://forum.kirupa.com/t/formatting-xml-with-css/251078>\
**Category:** Uncategorized\
**Created:** [February 5, 2008, 7:35am UTC](https://forum.kirupa.com/t/formatting-xml-with-css/251078 "2008-02-05T07:35:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecarte](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ecarte/32/467_2.png) [@ecarte](https://forum.kirupa.com/u/ecarte)\
**Post date:** [February 5, 2008, 7:35am UTC](https://forum.kirupa.com/t/formatting-xml-with-css/251078/1 "2008-02-05T07:35:34Z")

</div>

I am trying to add an external css file to format a text box.  
This is my code so far. I thought I would try to format the ‘toolltip’ first to test my ideas. Of course this code only adds the tags to the tooltip. What am I doing wrong?

**/////////////////////////////////////CSS  
var format = new TextField.StyleSheet();  
var path = “flash.css”;  
format.load(path);  
format.onLoad = function(loaded) {  
if (loaded) {  
theText.styleSheet = format;  
theText.text = “icons.xml”;  
} else {  
theText.text = “Error loading CSS file!”;  
}  
};  
/////////////////////////////////////////**

var tooltip:MovieClip = this.attachMovie(“tooltip”,“tooltip”,10000);  
tooltip.\_alpha = 0;

var xml:XML = new XML();  
xml.ignoreWhite = true;

xml.onLoad = function()  
{  
var nodes = this.firstChild.childNodes;  
numOfItems = nodes.length;  
for(var i=0;i\<numOfItems;i++)  
{  
var t = home.attachMovie(“item”,“item”+i,i+1);  
t.angle = i \* ((Math.PI_2)/numOfItems);  
t.onEnterFrame = mover;  
\*\* t.toolText += “\<h1\>”  
t.toolText = nodes_.attributes.tooltip;  
t.toolText += “\</h1\>” \*\*  
t.content = nodes\*.attributes.content;  
t.icon.inner.loadMovie(nodes\*.attributes.image);  
t.r.inner.loadMovie(nodes\*.attributes.image);  
t.icon.onRollOver = over;  
t.icon.onRollOut = out;  
t.icon.onRelease = released;  
**nodes.htmlText = t;**  
}  
}
