XML Menu spacing on the x-axis

I’m in a jam.

I’d like to layout an XML menu (similar to the “squirrelfinder” example in the Introduction to XML in Flash tutorial).

Instead of arranging the menu items vertically, I need a horizontal menu. Figuring out the even spacing is driving me nuts.

This is the Create Menu function I’m playing with:

function CreateMenu(menu_xml){
	var items = menu_xml.firstChild.childNodes;
	
	var item_count = 0;
	
	for (var i=0;i<items.length;i++){
		
		var mainMenuItem = items*.firstChild;
		
		var item_mc = menu_mc.attachMovie("menuItem","item"+item_count,item_count);

		var item_spacing = Stage.width/items.length;
//this item_spacing var is what I'm having trouble with.

		
		item_mc.item_txt.text = mainMenuItem.firstChild.nodeValue;
		
		item_mc._x = item_mc.item_spacing/item_txt.length;
		
		item_count++;
		
		
	}
}