# Help! Animate Drop-Menu w/dif Colors?

**URL:** https://forum.kirupa.com/t/help-animate-drop-menu-w-dif-colors/57631
**Category:** Uncategorized
**Created:** [July 14, 2004, 8:47pm UTC](https://forum.kirupa.com/t/help-animate-drop-menu-w-dif-colors/57631 "2004-07-14T20:47:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![thiedem](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@thiedem](https://forum.kirupa.com/u/thiedem)
#### Post date: [July 14, 2004, 8:47pm UTC](https://forum.kirupa.com/t/help-animate-drop-menu-w-dif-colors/57631/1 "2004-07-14T20:47:57Z")

</div>

Hi! I have already made my Drop-Menu horizontal from Senocular’s, similar to a previous postee, but I have also been trying to make buttons with different mouse-over and background colors. The submenus retain their colors, but I am having problems with the colors on the main menu, and have hit a wall. I would also like to animate the submenus with some sort of scroll effect – any help on this would be GREATLY appreciated!!

here are my source files, once again modified from Senocular’s:  
ActionScript:

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(“itemClip”,“item”+i+"\_mc", i);  
curr\_node = node\_xml.childNodes\*;  
if(name == “mainmenu\_mc”){  
curr\_item.\_x = i_curr\_item.\_width;  
curr\_item.\_y = y;  
}else{  
curr\_item.\_x = x;  
curr\_item.\_y = y + i_19;  
};  
curr\_item.trackAsMenu = true;  
curr\_item.action = curr\_node.attributes.action;  
curr\_item.variables = curr\_node.attributes.variables;  
curr\_item.bgColor = curr\_node.attributes.bgcolor;  
curr\_item.mouseColor = curr\_node.attributes.mouse;  
var col = new Color(curr\_item.background);  
col.setRGB(curr\_item.bgColor);  
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 = 19;  
GenerateMenu(curr\_menu, “submenu\_mc”, x, y, 1000, this.node\_xml);  
};  
}else{  
curr\_item.onRollOver = curr\_item.onDragOver = function(){  
var col = new Color(this.background);  
col.setRGB(curr\_item.mouseColor);  
};  
}

curr\_item.onRollOut = curr\_item.onDragOut = function(){  
var col = new Color(this.background);  
col.setRGB(curr\_item.bgColor);  
};  
curr\_item.onRelease = function(){  
Actionsthis.action;  
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.newMenu = function(menuxml){  
menu\_xml.load(menuxml);  
};  
menu\_xml = new XML();  
menu\_xml.ignoreWhite = true;  
menu\_xml.onLoad = function(ok){  
if (ok){  
Createmainmenu(0, 0, 0, this);  
}  
};  
menu\_xml.load(“new.xml”);

As you can see, I tried to mess around more with the colors . . .

AND

Source XML doc:

\<?xml version=“1.0”?\>  
\<menu name=“main”\>  
\<item name=“home” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x006635” mouse=“0x008C49”/\>  
\<menu name=“about us” bgcolor=“0x006772”\>  
\<item name=“overview” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x006772” mouse=“0098A8”/\>  
\<item name=“customer focus” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x006772” mouse=“0x0098A8”/\>  
\<item name=“quality systems” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x006772” mouse=“0x0098A8”/\>  
\<item name=“env. health safety” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x006772” mouse=“0x0098A8”/\>  
\</menu\>  
\<menu name=“solutions” bgcolor=“0x007EB0”\>  
\<item name=“industries” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x007EB0” mouse=“0x0099D6”/\>  
\<item name=“services” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x007EB0” mouse=“0x0099D6”/\>  
\<item name=“products” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x007EB0” mouse=“0x0099D6”/\>  
\</menu\>  
\<item name=“locations” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x0195E7” mouse=“0x3EB9FE”/\>  
\<menu name=“corporate” bgcolor=“0x0099FF”\>  
\<item name=“governance” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x0099FF” mouse=“0x45B4FF”/\>  
\<item name=“investor relations” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x0099FF” mouse=“0x45B4FF”/\>  
\<item name=“management” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x0099FF” mouse=“0x45B4FF”/\>  
\</menu\>  
\<menu name=“news” bgcolor=“0x0182E3”\>  
\<item name=“press releases” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x0182E3” mouse=“0x1C9DFE”/\>  
\<item name=“data sheets” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x0182E3” mouse=“0x1C9DFE”/\>  
\<item name=“presentations” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x0182E3” mouse=“0x1C9DFE”/\>  
\<item name=“media center” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x0182E3” mouse=“0x1C9DFE”/\>  
\<item name=“trade shows” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x0182E3” mouse=“0x1C9DFE”/\>  
\</menu\>  
\<menu name=“contact us” action=“gotoURL” bgcolor=“0x1A5AB8”\>  
\<item name=“careers” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x1A5AB8” mouse=“0x377DE3”/\>  
\<item name=“contacts” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x1A5AB8” mouse=“0x377DE3”/\>  
\<item name=“feedback” action=“gotoURL” variables=“[http://www.pemstar.com](http://www.pemstar.com/)” bgcolor=“0x1A5AB8” mouse=“0x377DE3”/\>  
\</menu\>  
\</menu\>

bgcolor and mouse correspond to the two colors for each button . . . Help!  
Thanks!!
