Help wiht converting this actionscript vertical menu to a horizontal menu?

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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. ...
    2. 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...
    3. 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...
    4. 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...
  3. #2

    Default 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...
    > 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._y = y;
    curr_item._x = x + i*curr_item._width

    > 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 y = this._y + this._height - 5;
    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.

    > 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]
    >
    >

    ilti Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139