Professional Web Applications Themes

Help wiht converting this actionscript vertical menu to a horizontal menu? - Macromedia Flash Actionscript

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); ...

  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. #2

    Default Re: Help wiht converting this actionscript vertical menu to a horizontal menu?

    See the quotes.
    "Synergy Media" <webforumsusermacromedia.com> wrote in message
    news:bv8lpb$3s6$1forums.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

Similar Threads

  1. Spry Menu - Horizontal
    By Symplig0thi in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 1
    Last Post: April 23rd, 07:22 AM
  2. Spry horizontal menu: vertical text align issue
    By ez. in forum Adobe Dreamweaver & Contribute
    Replies: 0
    Last Post: January 24th, 04:41 AM
  3. Dynamic Menu - Horizontal with sub options horizontal
    By FER. in forum Macromedia Dynamic HTML
    Replies: 5
    Last Post: May 11th, 02:37 PM
  4. Purchased PluginLab Vertical & Horizontal Flyout Menu
    By Paul H. Jones in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 6
    Last Post: May 16th, 04:39 PM
  5. Horizontal DropDown Menu
    By YWang webforumsuser@macromedia.com in forum Macromedia Dynamic HTML
    Replies: 3
    Last Post: August 13th, 10:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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