Hi,
I’m trying to convert the XML-driven Drop-Down menu by Senocular into a sitemap. I have a menu with 4 levels (main menu and 3 levels of submenu’s). Now I can get the script to display all menu-items, but some items are overlapped. What I need in the loop is to move the x,y position back left and down if the next parent-level of the menu needs to be drawn. Here’s my adjusted script, hope someone can help figure out what to do to make this work correctly:
GenerateMenu = function(container, name, x, y, depth, node_xml) {
// variable declarations
var curr_node;
var curr_item;
var curr_menu = container.createEmptyMovieClip(name, depth);
// for all items or XML nodes (items and menus)
// within this node_xml passed for this menu
for (var i=0; i<node_xml.childNodes.length; i++) {
// movieclip for each menu item
curr_item = curr_menu.attachMovie("menuitem","item"+i+"_mc", i);
//curr_item.name.autoSize = true;
curr_item._x = x;
curr_item._y = y + i*curr_item._height;
// item properties assigned from XML
curr_node = node_xml.childNodes*;
curr_item.name.text = curr_node.attributes.label;
if (node_xml.childNodes*.hasChildNodes()){
// open a submenu
curr_item.node_xml = curr_node;
var x = curr_item._x + curr_item._width - 5;
var y = curr_item._y + i*curr_item._height;
drawLine(curr_item._x+curr_item_.width,curr_item._y+(curr_item._height/2),x,y,i*20+100);
GenerateMenu(curr_menu, "submenu_mc", x, y, i*10+100, curr_item.node_xml);
}
// any item, menu opening or not can have actions
curr_item.onRelease = function(){
Actions[this.action](this.variables);
};
} // end for loop
};