3 Replies Latest reply on Sep 22, 2009 12:39 PM by kglad

    Make menu appear at top of button - not bottom

    sus3135 Level 1

      Not sure if this belongs in the ActionScript forum or not.  Sorry if it is misplaced .

       

      I'm creating a menu for a Flash project:  the subMenu shows up below the Menu Button -- I would like for it to show up above the Menu Button when the Menu Button is clicked.   Tried everything I could think of -  here's the code:

       

      _global.style.setStyle("themeColor", "haloBlue");

       

      import mx.controls.Menu;

      var cmMainMenu:Menu = Menu.createMenu();

      cmMainMenu.addMenuItem({label: "Glossary", instanceName:"miGlossary"});

      cmMainMenu.addMenuItem({label: "Powerpoint", instanceName: "miPowerpoint"});

       

      var changeListener = new Object();
      changeListener.change = function(evt_obj:Object) {

      var item_obj:Object = evt_obj.menuItem;


      if( item_obj.attributes.label=="Glossary" ){
         
          getURL("Glossary.html","emptyClip");
         } 
         else if  (item_obj.attributes.label == "Powerpoint") {
          getURL("Powerpoint", "emptyClip");
       

      }
      }

      cmMainMenu.addEventListener("change", changeListener);
         
      //Add a button that displays the menu when the button is clicked
      var listener = new Object();
      listener.click = function(evtObj) {
      var button = evtObj.target;
      //get reference to the button
      // Display the menu at the bottom of the button
      _root.cmMainMenu.show(button.x, button.y+button.height);

      }
      MainMenu_btn.addEventListener("click", listener);
      //exit.onPress =function() {
      //fscommand("quit");
      //}

      stop();

      Any help would be appreciated.   Thanks