problem with code
i got the following code from the internet. it loads an xml file into a
horizontal dropdown menu.
the problem is that it doesn't place the buttons besides eachother but at the
same place, so you can only see one button
who can find the problem for me.
function menuOut(xml, movW, mcH, mcW, xpos, ypos)
{
xpos = xpos;
ypos = ypos;
startPos = xpos;
items = xml.firstChild.childNodes;
for (a = 0; a <= items.length - 1; a++)
{
subs = xml.firstChild.childNodes[a].childNodes;
iattrib = items[a].attributes;
item = _root.attachMovie("menuItem", "item" + a, a);
item.nametxt.text = iattrib.id;
subContain = _root.createEmptyMovieClip("subContain" + a, a + 1000);
for (b = 0; b <= subs.length - 1; b++)
{
attribs = subs.attributes;
sub = _root.subContain.attachMovie("menuItem", "sub" + b, b + 100);
sub.nametxt.text = attribs.id;
sub._y = mcH * b + mcH;
sub.itemUrl = attribs.theURL;
sub.onRelease = function ()
{
getURL(this.itemUrl, "_blank");
};
} // end of for
_root["subContain" + a]._visible = false;
_root["subContain" + a]._x = xpos;
_root["subContain" + a]._y = ypos;
item.num = a;
item.box.subsL = subs.length;
_root["item" + a].box.onRollOver = function ()
{
this._height = this.subsL * mcH + mcH + 8;
trace (this._height);
};
_root["item" + a].onMouseMove = function ()
{
mY = _root._ymouse;
mX = _root._xmouse;
this.subHit = _root["subContain" + this.num].hitTest(mX, mY);
this.itemHit = this.box.hitTest(mX, mY);
if (this.itemHit == true)
{
_root["subContain" + this.num]._visible = true;
}
else
{
_root["subContain" + this.num]._visible = false;
this.box._height = mcH;
} // end if
};
item._x = xpos - 10;
item._y = ypos;
xpos = xpos + xMove;
if (xpos >= movW - mcW / 2)
{
ypos = ypos + yMove;
xpos = startPos;
} // end if
} // end of for
} // End of the function
menu = new XML();
menu.ignoreWhite = true;
menu.load("http://purephotoshop.com/uploads/submen.xml");
menu.onLoad = function ()
{
menuOut(this, 350, 25, 125, 75, 15);
};
|