Vertical Cascading Menu driven by XML

I know how to build a menu in flash using XML, but I want to know how to assign ActionScript to make it cascade on rollover.  So if I have a structured the following in XML

main btn
    sub btn
    sub btn
    sub btn
    sub btn
main btn
    sub btn
    sub btn
main btn
    sub btn
main btn
main btn

that when you roll over the main btns the sub buttons cascade down and the other main buttons underneath move down as well.  Am I being clear because I do not feel like I am?  Also thank you in advanace for your help.

Franky
frankybonesAsked:
Who is Participating?
 
GranModConnect With a Mentor Commented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0
 
Dushan De SilvaTechnology ArchitectCommented:
0
 
frankybonesAuthor Commented:
I understand how to make an object that is already on the stage move using easing.  Yet again I am loading all of my buttons into a blank mc from the library.  How many buttons depends on how many are defined in an XML file.  I do not know how to assign the easing to a button that does not exist on a stage or how to tell it to ease the buttons below it because they are attached via this script:

menu.attachMovie("button", "btn"+i, 5000+i);

 Also when you rollover the button I want the sub buttons to be attached and the rest of the menu to move down as to reveal the sub menu.  Here is an example of what I am sort of doing:  

http://www.kirupa.com/developer/actionscript/xml_dropdown_menu4.htm

Except instead of the sub menus showing up to the side I want the other buttons to slide down and the sub buttons show up in between. Like this but without using CSS:

http://www.frunder.com/products/flash/menu/demos.htm

And I do not want to buy this, I want to understand how to do it.

Thank you for your efforts,

Franky



0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
frankybonesAuthor Commented:
Okay, here is my code that I have so far.  The only thing that I am lacking is the ability to make it move on a mouse event.  If you need to see the fla.  let me know and I will post on a website in a zip file for download.  Now for the code that I have:

Stage.showMenu = false;
Stage.align = "TL";
Stage.scaleMode = "noScale";
menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function(ok) {
      // create menu after successful loading of XML
      if (ok) {
            create_menu();
      } else {
            trace("XML not loaded");
      }
};
// load XML menu
menu_xml.load("XML/forkMenu2.xml");
//
total_subs = 0;
most_subs = 0;
function create_menu() {
      //Load menu options from XML
      rollover_delay = menu_xml.firstChild.childNodes[0].attributes.rollover_delay;
      text_color1 = "0x"+menu_xml.firstChild.childNodes[0].attributes.text_color1;
      text_color2 = "0x"+menu_xml.firstChild.childNodes[0].attributes.text_color2;
      //internally set options
      var menuSpacer = .5;
      //sets the vertical space between main items
      var subSpacer = 0;
      //sets the vertical space between sub items
      var menuSpeed = 3;
      //sets the menu animation speed
      var menuTolerance = 1;
      var subDelay = 50;
      //set the delay for the sub items entering the stage
      var itemDelay = 100;
      //creat main menu
      for (i=1; i<menu_xml.firstChild.childNodes.length; i++) {
            my_menu2.attachMovie("button_typeSub", "sub2"+i, i);
            my_menu2.attachMovie("button_type2", "btn2"+i, 5000+i);
            //set button position
            my_menu2["btn2"+i]._x = 4;
            my_menu2["btn2"+i]._y = (my_menu["btn2"+i]._height+menuSpacer)*i;
            //set button text attributes
            my_menu2["btn2"+i].textul.textColor = text_color1;
            my_menu2["btn2"+i].the_text = menu_xml.firstChild.childNodes[i].attributes.text;
            //set button color
            main_btn_color = new Color(my_menu2["btn2"+i].color_clip);
            main_btn_color.setRGB("0x"+menu_xml.firstChild.childNodes[0].attributes.main_buttons_color);
            //set actions
            my_menu["sub2"+i].menu_number = i;
            my_menu2["btn2"+i].menu_number = i;
            my_menu2["btn2"+i].what = menu_xml.firstChild.childNodes[i].attributes.what;
            my_menu2["btn2"+i].where = menu_xml.firstChild.childNodes[i].attributes.where;
            my_menu2["btn2"+i].the_type = menu_xml.firstChild.childNodes[i].attributes.type;
            my_menu2["btn2"+i].onRelease = function() {
                  if (this.the_type != undefined) {
                        if ((this.the_type == "geturl") or (this.the_type == "getURL")) {
                              unloadMovie(_root.dropZone);
                              getURL(this.what, this.where);
                        }
                        if ((this.the_type == "gotoAndPlay") or (this.the_type == "gotoandplay")) {
                              unloadMovie(_root.dropZone);
                              tellTarget (this.where) {
                                    gotoAndPlay(this.what);
                              }
                        }
                        if ((this.the_type == "gotoAndStop") or (this.the_type == "gotoandstop")) {
                              unloadMovie(_root.dropZone);
                              tellTarget (this.where) {
                                    gotoAndStop(this.what);
                              }
                        }
                        if ((this.the_type == "loadMovie") or (this.the_type == "loadmovie")) {
                              loadMovie(this.what, this.where);
                        }
                        if ((this.the_type == "attachMovie") or (this.the_type == "attachmovie")) {
                              tellTarget (this.where) {
                                    attachMovie(this.what, this.what+i, i);
                              }
                        }
                        if ((this.the_type == "fsCommand") or (this.the_type == "fscommand")) {
                              unloadMovie(_root.dropZone);
                              fscommand(this.what, this.where);
                        }
                        if ((this.the_type == "function") or (this.the_type == "Function")) {
                              unloadMovie(_root.dropZone);
                              eval(this.where)[this.what]();
                        }
                  }
            };
            //if the node has childs create sub buttons
            if (menu_xml.firstChild.childNodes[i].hasChildNodes()) {
                  create_sub(i);
            }
      }
}
function create_sub(the_node) {
      for (ii=0; ii<menu_xml.firstChild.childNodes[the_node].childNodes.length; ii++) {
            my_menu["sub2"+the_node].attachMovie("button_typeSub", "s"+ii, 8000+ii);
            //set button text attributes
            my_menu2["sub2"+the_node]["s"+ii].textul.textColor = text_color1;
            my_menu2["sub2"+the_node]["s"+ii].the_text = menu_xml.firstChild.childNodes[the_node].childNodes[ii].attributes.text;
            //set button color
            sub_btn_color = new Color(my_menu2["sub2"+the_node]["s"+ii].color_clip);
            sub_btn_color.setRGB("0x"+menu_xml.firstChild.childNodes[the_node].childNodes[ii].attributes.main_buttons_color);
            //set actions
            my_menu2["sub2"+the_node]["s"+ii].what = menu_xml.firstChild.childNodes[the_node].childNodes[ii].attributes.what;
            my_menu2["sub2"+the_node]["s"+ii].where = menu_xml.firstChild.childNodes[the_node].childNodes[ii].attributes.where;
            my_menu2["sub2"+the_node]["s"+ii].the_type = menu_xml.firstChild.childNodes[the_node].childNodes[ii].attributes.type;
            //
            my_menu["sub"+the_node]["s"+ii].onRelease = function() {
                  if (this.the_type != undefined) {
                        if ((this.the_type == "geturl") or (this.the_type == "getURL")) {
                              unloadMovie(_root.dropZone);
                              getURL(this.what, this.where);
                        }
                        if ((this.the_type == "gotoAndPlay") or (this.the_type == "gotoandplay")) {
                              tellTarget (this.where) {
                                    gotoAndPlay(this.what);
                              }
                        }
                        if ((this.the_type == "gotoAndStop") or (this.the_type == "gotoandstop")) {
                              unloadMovie(_root.dropZone);
                              tellTarget (this.where) {
                                    gotoAndStop(this.what);
                              }
                        }
                        if ((this.the_type == "loadMovie") or (this.the_type == "loadmovie")) {
                              loadMovie(this.what, this.where);
                        }
                        if ((this.the_type == "attachMovie") or (this.the_type == "attachmovie")) {
                              attachMovie(this.what, this.where);
                        }
                        if ((this.the_type == "fsCommand") or (this.the_type == "fscommand")) {
                              unloadMovie(_root.dropZone);
                              fscommand(this.what, this.where);
                        }
                        if ((this.the_type == "function") or (this.the_type == "Function")) {
                              unloadMovie(_root.dropZone);
                              eval(this.where)[this.what]();
                        }
                  }
            };
      }
}
0
 
frankybonesAuthor Commented:
Anyone?
0
 
frankybonesAuthor Commented:
I got it figured out and I am asking that since none of the response helped that this be closed and that my points be refunded.

FB
0
All Courses

From novice to tech pro — start learning today.