2 Replies Latest reply on Jan 31, 2007 9:00 AM by rvguys

    Simple Multiple Drop Down Menus dont work

    rvguys
      I'm trying to get several instances of a menu to work in Flash 8. I want to have 16 thumbnail images, each with a different drop down menu associated with it. I can get it to make the menus, but the showMenu positioning won't allow me to create different locations for each menu. This sample code always results in the LAST menu being shown. Only one will show at a time. What am I missing? Thanks

      // sample code to display 2 drop down menus from Flash 8. Only one at a time will display
      import mx.controls.Menu;

      var my_xml:XML = new XML();

      // Create items for the first menu my_xml
      var newItem_obj:Object = my_xml.addMenuItem({label:"New"});
      my_xml.addMenuItem({label:"Open", instanceName:"miOpen"});
      my_xml.addMenuItem({label:"Save", instanceName:"miSave"});
      my_xml.addMenuItem({type:"separator"});
      my_xml.addMenuItem({label:"Quit", instanceName:"miQuit"});

      // Create the second menu.
      var my_xml2:XML = new XML();

      // Create items for the menu.
      var newItem_obj:Object = my_xml2.addMenuItem({label:"New2"});
      my_xml2.addMenuItem({label:"Open2", instanceName:"miOpen"});
      my_xml2.addMenuItem({label:"Save2", instanceName:"miSave"});
      my_xml2.addMenuItem({type:"separator"});
      my_xml2.addMenuItem({label:"Quit2", instanceName:"miQuit"});

      // now create the first menu - my_xml and my_menu
      var my_menu:Menu = Menu.createMenu(_root, my_xml);
      _root.my_menu.show(100, 20);

      // Create and show the second menu.
      var my_menu2:Menu = Menu.createMenu(_root, my_xml2);
      _root.my_menu2.show(300, 20);


      // now set up the listeners

      var menuListener1:Object = new Object();
      menuListener1.change = function(evt_obj:Object) {
      trace("Menu item chosen1: " + evt_obj.menuItem.attributes.label);
      _root.my_menu.show(100, 20);
      _root.my_menu2.show(300, 20);
      };

      var menuListener2:Object = new Object();
      menuListener2.change = function(evt_obj:Object) {
      trace("Menu item chosen2: " + evt_obj.menuItem.attributes.label);
      _root.my_menu.show(100, 20);
      _root.my_menu2.show(300, 20);
      };
      // set up the listeners so we know which item was selected
      my_menu.addEventListener("change", menuListener1);
      my_menu2.addEventListener("change", menuListener2);