all groups > flash actionscript > june 2006 >
You're in the

flash actionscript

group:

Pop-Up Menu



Pop-Up Menu Okie6316
6/2/2006 6:03:03 PM
flash actionscript: 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

<a target=_blank class=ftalternatingbarlinklarge
href="mailto:kurtzds@cox.net">E-Mail</a>

<a target=_blank class=ftalternatingbarlinklarge
href="http://www.kurtzdesignstudio.com/popup_menu/popup.html">PopUp Menu
Link</a>
Re: Pop-Up Menu TimSymons
6/3/2006 1:44:36 AM
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
Re: Pop-Up Menu TimSymons
6/3/2006 2:28:18 AM
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.

<a target=_blank class=ftalternatingbarlinklarge
href="http://home.fuse.net/symons/sme.fla">http://home.fuse.net/symons/sme.fla</
a>

Hope this helps.

Tim
Re: Pop-Up Menu Okie6316
6/3/2006 5:43:45 AM
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,
Re: Pop-Up Menu TimSymons
6/3/2006 7:36:46 PM
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.

<a target=_blank class=ftalternatingbarlinklarge
href="http://home.fuse.net/symons/sme7.fla">http://home.fuse.net/symons/sme7.fla
</a>

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
AddThis Social Bookmark Button