Looped buttons and text sizing

Hello all

I have a set of buttons which loop based on the length (number) of children in XML. The labels of the buttons are an attribute of each child node. right now I am looping an equally sized button but in fact need each button to be resized based on the amount of text in each of the child nodes in XML. In other words, if the button label is “cowagunga dude” the button needs to be the size of that phrase. THe buttons always need to be looped from the right to the left as well (which i have pretty much figured out). The code that I am using is as follows:

//load the xml
menuXML = new XML();
menuXML.ignoreWhite = true;
menuXML.load(“list.xml”);
menuXML.onLoad = function(success) {
createBottomMenu();
}
//attach some dummys off the stage because we are counting backwards and need to measure the width of these items
_root.attachMovie(“menuEnd”, “endDummy”, 3);
_root.endDummy._y = 100;
_root.attachMovie(“navButton”, “dummy”, 4);
_root.dummy._y = 100;

//create a function to make the nav elements
function createBottomMenu() {
//find the amount of elements in the nav
loopAmount = menuXML.firstChild.firstChild.childNodes.length;
_root.createEmptyMovieClip(“navContain”, “navContain”, 5);
_root.navContain.attachMovie(“menuEnd”, “menuEnd”, 10);
//place a bookend at the edge of the stage (minus its own width);
_root.navContain.menuEnd._x = Stage.width-_root.endDummy._width;
_root.navContain._y = .5;
//create a width variable based on our dummy
startX = Stage.width+(-_root.navContain.menuEnd._width-(dummy._width));
trace(“created”);
//loop the nav elements
for (i=0; i<loopAmount; i++) {
navContain.attachMovie(“navButton”, “navButton”+i, i);
navContain[“navButton”+i]._x = startX;
navContain[“navButton”+i].slot.html = true;
//name the xml link and the button content
navContain[“navButton”+i].slot.text = menuXML.firstChild.firstChild.childNodes*.attributes.menuName;
navContain[“navButton”+i].link = menuXML.firstChild.firstChild.childNodes*.attributes.menuLink+".html";
startX -= navContain.navButton0._width;
var theEnd = navContain[“navButton”+i]._x;
}
//attach the bookend on the left
_root.navContain.attachMovie(“menuBegin”, “menuBegin”, 50);
_root.navContain.menuBegin._x = theEnd-(_root.navContain.menuBegin._width);
}

USUALLY i am pretty sure i can figure stuff out on my own but i have NO idea how to make this happen… I am thinking something to do with enterframe clipevents on the buttons or something but i really dont know … COMPLETELY banging my head against the wall. If anyone can help me i would be very grateful. Is it even possible to do what I am asking??

Thanks

E :-/