Dynamic XML/AS Menu Bar

Hi Kirupians… :bounce:

I need some help with this small project. Basically i’m trying to get the onRollOver function to work with this menu bar. http://www.irl-fca.net/menuxml.htm

This is the source download http://www.irl-fca.net/XMLMenu.zip

For the life of me, I can’t get it to work. If someone could please have a look at it. All I want to do is roll over and change the background color of the cell.

I’ve tried adding it in as a behaviour in the submenu movie clips. But when i try to trace the onRollOver, nothing happens.

Any help will be appricated.

Rgds
ANIMAL

This is how the XML looks.

 
<?xml version="1.0"?>
<menu>
<item id="Services">
<sub id="This" theURL="[[color=#339900]http://www.your.com[/color]](http://www.your.com/)" />
<sub id="is" theURL="[[color=#339900]http://www.your.com[/color]](http://www.your.com/)" />
<sub id="random" theURL="[[color=#339900]http://www.your.com[/color]](http://www.your.com/)" />
<sub id="stuff" theURL="[[color=#339900]http://www.your.com[/color]](http://www.your.com/)" />
</item>
<item id="About">
<sub id="This" theURL="[[color=#339900]http://www.your.com[/color]](http://www.your.com/)" />
<sub id="is" theURL="[[color=#339900]http://www.your.com[/color]](http://www.your.com/)" />
<sub id="random" theURL="[[color=#339900]http://www.your.com[/color]](http://www.your.com/)" />
<sub id="stuff" theURL="[[color=#339900]http://www.your.com[/color]](http://www.your.com/)" />
</item>
</menu>

This is the ActionScript.

 
submen = new XML ();
submen.ignoreWhite = true;
function menuOut(xml, movW, mcH, mcW, xpos, ypos){
 
xMove = 122; 
yMove = 135;
xpos = 64;
ypos = 115;
startPos = xpos;
items = xml.firstChild.childNodes;
for(a = 0; a<= items.length-1; a++)
{
subs = xml.firstChild.childNodes[a].childNodes;
	iattrib = items[a].attributes;
//trace(iattrib.id); //Will return the name of the current item
//= xml.firstChild.childNodes[a].childNodes**.childNodes;
 
item = _root.attachMovie( "menuItem", "item"+a, a);
	 item.nametxt.text = iattrib.id;
subContain = _root.createEmptyMovieClip("subContain"+a, a+1000);
	 for(z = 0; z<= subs.length-1; z++)
{ 
attribs = subs[z].attributes;
		 sub =_root.subContain.attachMovie( "submenuItem", "sub"+z, z+100);
		 sub.nametxt.text = attribs.id;
sub._y = (mcH*z)+mcH;
		 sub.itemUrl = attribs.theURL;
	 sub.onRelease = function()
{
			 getURL(this.itemUrl, "_blank");
		 }
	 }//END OF FOR B LOOP
//trace(subs);
_root["subContain"+a]._visible=false;
	_root["subContain"+a]._x = xpos;
	_root["subContain"+a]._y = ypos;
item.num = a;
_root["item"+a].box.subsL = subs.length;
_root["item"+a].box.onRollOver = function()
{
	 this._height = (this.subsL*mcH)+mcH+8;
}
_root["item"+a].onMouseMove = function()
{
	 //Reference variables to the mouse coords
	 mY = _root._ymouse;
	 mX = _root._xmouse;
 
	 //Local reference to whether the subContain is hit or not
	 this.subHit = _root["subContain"+this.num].hitTest(mX, mY);
	 //Local reference to whether the box is hit or not
	 this.itemHit = this.box.hitTest(mX, mY);
	 if(this.itemHit == true)
{
		 _root["subContain"+this.num]._visible = true;
	 }else{
		 _root["subContain"+this.num]._visible = false;
		 //Snaps our hitbox back to the size of just the main item.
		 this.box._height = mcH;
	 }
	}
item._x = xpos; //positioning of the subs
	item._y = ypos;
//increments the xposition of our whole menu by xmove
xpos += xMove;
//simple if test to see if we will be off the screen
if(xpos >= movW-mcW/2)
{
	 //increments our whole menu's _y by ymove
			ypos += yMove;
	 //resets our xpos
			xpos = startPos;
	 }
}//END OF FOR A LOOP
}//END OF FUNCTION
submen.onLoad = function(){
menuOut(this, 1200, 28, 122, 75, 15, "menuItem");
}
submen.load ("submen.xml");