Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
Synergy Media webforumsuser@macromedia.com #1
Help wiht converting this actionscript vertical menu to a horizontal menu?
I've been fiddling around with this script and I think my ActionScript is a bit too rusty for accomplishing what I want to change.
I've been trying to convert it to a horizontal menu, right now it comes up like this:
MainMenu Item
MainMenu SubMenu Item Item
ManiMenu Item Item
MainMenu SubMenu SubSubMenu Item
I've been trying to create:
MainMenu MainMenu MainMenu
Item Item Item
Item Item Item
Item Item Item
Thanks.
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);
curr_item._x = x;
curr_item._y = y + i*curr_item._height;
curr_item.trackAsMenu = true;
curr_node = node_xml.childNodes[i];
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[i].nodeName == "menu"){
curr_item.node_xml = curr_node;
curr_item.onRollOver = curr_item.onDragOver = function(){
var x = this._x + this._width - 5;
var y = this._y + 5;
GenerateMenu(curr_menu, "submenu_mc", x, y, 1000, this.node_xml);
var col = new Color(this.background);
col.setRGB(0xf4faff);
};
}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.setRGB(0xf4faff);
};
}
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,b b: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){
message_txt.text = msg;
};
Actions.newMenu = function(menuxml){
menu_xml.load(menuxml);
};
menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function(ok){
if (ok){
Createmainmenu(10, 10, 0, this);
message_txt.text = "message area";
}else{
message_txt.text = "error: XML not successfully loaded";
}
};
menu_xml.load("menu1.xml");
[url]http://webforums.macromedia.com/attachments/xmlmenu.zip[/url]
Synergy Media webforumsuser@macromedia.com Guest
-
Spry Menu - Horizontal
Website that's being worked on :: http://shilohsteel.com/Edit I'm not sure really where to post this so I'm sorry if it's in the wrong place. ... -
Spry horizontal menu: vertical text align issue
Hello all, I have a simple horizontal Spry menu I'm working on. The menu is single level - no submenus. The problem is that I cannot get the... -
Dynamic Menu - Horizontal with sub options horizontal
Hi, folks. Well, I've trying to make a horizontal menu with show/hide layers but the result is not that I want. I would like to do a menu like... -
Purchased PluginLab Vertical & Horizontal Flyout Menu
Purchased PluginLab Vertical & Horizontal Flyout Menu, V1.4 Dreamweaver plugins (Macromedia Dreamweaver Exchange top picks). After trying to use... -
ilti #2
Re: Help wiht converting this actionscript vertical menu to a horizontal menu?
See the quotes.
"Synergy Media" <webforumsuser@macromedia.com> wrote in message
news:bv8lpb$3s6$1@forums.macromedia.com...a bit too rusty for accomplishing what I want to change.> I've been fiddling around with this script and I think my ActionScript islike this:>
> I've been trying to convert it to a horizontal menu, right now it comes upcurr_item._y = y;>
> MainMenu Item
> MainMenu SubMenu Item Item
> ManiMenu Item Item
> MainMenu SubMenu SubSubMenu Item
>
> I've been trying to create:
>
> MainMenu MainMenu MainMenu
> Item Item Item
> Item Item Item
> Item Item Item
>
>
>
> Thanks.
> 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);
curr_item._x = x + i*curr_item._width
var y = this._y + this._height - 5;> curr_item.trackAsMenu = true;
> curr_node = node_xml.childNodes[i];
> 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[i].nodeName == "menu"){
> curr_item.node_xml = curr_node;
> curr_item.onRollOver = curr_item.onDragOver = function(){
var x = this._x+ 5;
I didn't test the code, but it is a guess.. but if you are using this
function you should already know this.
hth.
_root._ymouse, true)){> GenerateMenu(curr_menu, "submenu_mc", x, y, 1000, this.node_xml);
> var col = new Color(this.background);
> col.setRGB(0xf4faff);
> };
> }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.setRGB(0xf4faff);
> };
> }
>
> 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,b b: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,> CloseSubmenus();
> }
> };
> };
> CloseSubmenus = function(){
> mainmenu_mc.submenu_mc.removeMovieClip();
> };
>
> Actions = Object();
> Actions.gotoURL = function(urlVar){
> getURL(urlVar, "_blank");
> };
> Actions.message = function(msg){
> message_txt.text = msg;
> };
> Actions.newMenu = function(menuxml){
> menu_xml.load(menuxml);
> };
>
> menu_xml = new XML();
> menu_xml.ignoreWhite = true;
> menu_xml.onLoad = function(ok){
> if (ok){
> Createmainmenu(10, 10, 0, this);
> message_txt.text = "message area";
> }else{
> message_txt.text = "error: XML not successfully loaded";
> }
> };
> menu_xml.load("menu1.xml");
>
> [url]http://webforums.macromedia.com/attachments/xmlmenu.zip[/url]
>
>
ilti Guest



Reply With Quote

