Sen's Xml Menu - Now Drop Down

hey guys you know Sen’s xml menu well i’ve updated it a bit grabbed some code from somewhere else on this and added a simple little bit of code in my self so that youcan have a horizontal menu with the pop out bits as vertical menus. I’ve also made it so that you can have the pop out menu as a different menuitem than the horizontal bit.
You can easily make it so that the first menu is vertical and the pop out as horizontal or have them both going on the same axis

Follow Sen’s tutorial on this site on Xml Pop Up Menu’s

here’s the code… i hope this is what someone else is looking for…

  GenerateMenu = function(container, name, x, y, depth, node_xml) {
 var curr_node;
 var curr_item;
 var curr_menu = container.createEmptyMovieClip(name, depth);
 for (var i=0; i<node_xml.childNodes.length; i++) {
  curr_item = curr_menu.attachMovie("menuitem","item"+i+"_mc", i);
  
  if (name == "mainmenu_mc") {
   curr_item._x = x + i*100;
   curr_item._y = y;
  } else {
  curr_item = curr_menu.attachMovie("submenu","item"+i+"_mc", i);
   curr_item._x = x;
   curr_item._y = y+i*16;
  }
  curr_item.trackAsMenu = true;
  curr_node = node_xml.childNodes*;
  curr_item.action = curr_node.attributes.action;
  curr_item.variables = curr_node.attributes.variables;
  curr_item.name.text = curr_node.attributes.name;
  if (node_xml.childNodes*.nodeName == "menu"){
   curr_item.node_xml = curr_node;
   curr_item.onRollOver = curr_item.onDragOver = function(){
	var x = this._x;
	var y = this._y+16;
	GenerateMenu(curr_menu, "submenu_mc", x, y, 1000, this.node_xml);
	var col = new Color(this.background);
	col.setTransform({ra:50,rb:0,ga:50,gb:0,ba:50,bb:0});;
   };
  }else{
   curr_item.arrow._visible = false;
   curr_item.onRollOver = curr_item.onDragOver = function(){
	curr_menu.submenu_mc.removeMovieClip();
	var col = new Color(this.background);
	col.setTransform({ra:50,rb:0,ga:50,gb:0,ba:50,bb:0});;
   };
  }
  
  curr_item.onRollOut = curr_item.onDragOut = function(){
   var col = new Color(this.background);
   col.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
  };
  curr_item.onRelease = function(){
   Actions[this.action](this.variables);
   CloseSubmenus();
  };
 }
};
Createmainmenu = function(x, y, depth, menu_xml){
 GenerateMenu(this, "mainmenu_mc", x, y, depth, menu_xml.firstChild);
 mainmenu_mc.onMouseUp = function(){
  if (mainmenu_mc.submenu_mc && !mainmenu_mc.hitTest(_root._xmouse, _root._ymouse, true)){
   CloseSubmenus();
  }
 };
};
CloseSubmenus = function(){
 mainmenu_mc.submenu_mc.removeMovieClip();
};
Actions = Object();
Actions.gotoURL = function(urlVar){
 getURL(urlVar, "_blank");
};
Actions.message = function(msg){
 _root.message_txt.text = msg;
};
Actions.loadVars = function(Vars){
 loadVariables("Vars", _root.message_txt);
};
menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function(ok){
 if (ok){
  Createmainmenu(10, 10, 0, this);
  _root.message_txt.text = "message area";
 }else{
  _root.message_txt.text = "error:  XML not successfully loaded";
 }
};
menu_xml.load("menu.xml");

You will need to make another movieclip just like the “menuItem” mc and name it “submenu” and export it for actionscript under that name…

Had a quick question, something i posted as a question in another thread. Do your submenus only close when another menu item is "rollover"d? In my case if the submenu is open and my mouse moves off the menu all together, the submenu will stay open.

Does that make sense?

Yeah they stay open until you click on something else… this avoids the factor or premature closing of the submenu… just having it so it disapears on rollout doesn’t work well trust me…

I’ve also made it so instead of having the background colour change on rollover i’ve made it so it can play a certain part of a movieclip and then on rollout have it play a another part of frames so it gives it a smooth roll in and out transition… you can actually put any action in that place… obvious or not so obvious

I’m new to actionscript but in the last week or so it’s just all clicked all of a sudden so i’m having fun… i’ll never be as good as sen or any of the other top guys on here but i can only try