1 Reply Latest reply on Jul 19, 2010 1:53 PM by Faaguirre21

    Flash menu component

    jake1471
      i created an application and it has a menu bar at the top of the stage it also has a loader component below it.
      i need the loader to load an swf when an item is selected from the menu.

      Does anybody know how to code this.

      I am using the following code:

      import mx.controls.Menu;
      import mx.controls.MenuBar;
      var my_mb:MenuBar;
      // menu 1
      var my_menu = my_mb.addMenu("Home");
      my_menu.addMenuItem({label:"Go Home", instanceName:"Home"});
      // menu 2
      var my_menu:Menu = my_mb.addMenu("Bands");
      my_menu.addMenuItem({label:"Band Directory", instanceName:"Band_Directory"});


      //Create listener object.
      var mbListener:Object = new Object();
      mbListener.change = function(evt_obj:Object) {
      var menuItem_obj:Object = evt_obj.menuItem;
      switch (menuItem_obj.attributes.instanceName) {
      case "Home" :
      break;
      case "Band_Directory" :
      break;
      }
      trace(menuItem_obj);
      };
      //Add listener.
      my_menu.addEventListener("change", mbListener);

      Thanks for any help
        • 1. Re: Flash menu component
          Faaguirre21

          you should try for example something like

           

          var changeListener = new Object();
          changeListener.change = function(event) {
          gotoAndStop(event.menuItem.attributes.instanceName);
          }

           

          this listener make the movie go to the frame that has the same label as the instanceName atribute in Menu.