4 Replies Latest reply on Jun 3, 2006 12:36 PM by TimSymons

    Pop-Up Menu

    Okie6316
      I created a simple popup menu but I need help creating sub-menus to come off the side. I'm not sure exactly how you go about doing that. When I did try it I had a hard time getting the menu to disappear when the mouse was rolled off of it. I provided the fla file if somebody would like to work it over and email it back to me or explain how to go about creating it. Thanks

      E-Mail

      PopUp Menu Link
        • 1. Re: Pop-Up Menu
          TimSymons Level 1
          One method that I use is to not use the onRollOut event handler on the buttons or their children. Instead I have another movieclip that is below all of the possible buttons, with it's _alpha set to 0 and an onRollOver event set to trigger the menu to close.

          When a user enters the menu, I dynamically resize this movieclip to be about 50 pixels larger in every direction than the current size of the menu. I also have another movie clip just above this one that catches all mouse events while the user is near the menu. This is so when the user moves from button to button they don't actually activate the closing routine of the bottom movie clip.

          So at the very least I have 4 layers. top layer for scripts, next layer for all of the buttons with sub-menus displayed on different frames, the next layer contains a resizable movieclip to capture mouse events between buttons while in the menu and the last layer to activate the close routine for the menu.

          If I want to add opening an closing animations I would place this code in a class (for more control) and add animation with the Tween class.

          I will pullout an example for a previous project and post an example for you. Also, this is not the only way but was just the way I started using it.

          Tim
          • 2. Re: Pop-Up Menu
            TimSymons Level 1
            Hey, sorry but I don't have the code with me at home and my remote access to work is currently down. I did put together a simple example of what I was talking about. It is not finished from a coding perspective by a long shot but it should give you the idea.

            http://home.fuse.net/symons/sme.fla

            Hope this helps.

            Tim
            • 3. Re: Pop-Up Menu
              Okie6316 Level 1
              Tim,
              Thanks for your response. I was unable to open your file probably because I have Flash MX 2004. If you could please save the file in an earlier version.

              Thanks,
              Mike
              • 4. Re: Pop-Up Menu
                TimSymons Level 1
                No problem. I also spent a little time and made my *very* rough example a little better. I left the event captures at _alpha=100 so that you could see where they were placed when the submenu appears.

                http://home.fuse.net/symons/sme7.fla

                Again, this is rough and is just to get you thinking about the design. My finished menu works from an XML file and draws all of the boxes on the screen using the DrawAPI (though I didn't write that part :)) and animates them opened and closed with the Tween class but this took a while for me to code. Also, the one thing I found was that it was easier to build each menu and submenu as a separte movieclip (this especially helped with animation) and then use a class for the menu functions and a parent class as the menu engine.

                Anyway, I hope this helps you out.

                Tim