Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-28-2006, 07:28 AM   #1
Registered User
Join Date: Mar 2006
Posts: 13
Exclamation Dynamic menu help

Hello. I have a little problem. Currently I have a vertical menu which is generated via xml. Each menu item also has its own sub menu (not shown). When clicking on the top level item i want the rest of the items to move down to show the sub navigation. ie

menu item 1
menu item 2
menu item 3
menu item 4


menu item 1
sub menu 1
sub menu 2
sub menu 3
menu item 2
menu item 3
menu item 4

I have that working fine, but i havnt a clue how to fix it. Say if i have clicked on menu item 1, and the sub menu is displaying, before i have can view another sub menu i have to click on menu item 1 to close it before I can click on menu item 2.

this is the code that im using to tell weather or not to move the buttons up or down:
menuButton.clicked = false;
menuButton.onRelease = function () { 
	if(menuButton.clicked == false) {
		_root.moveMovieDown(buttonNum, buttonHeights);
		menuButton.clicked = true;
	} else {
		menuButton.clicked = false; 

Basicly i want to be able to click on any menu item button, if a menu item is open, i want it to close, and then open the new one. just like this one. http://www.bridgehead.com.au/case.php

hope it makes sense :-)
mattzi is offline   Reply With Quote
Old 10-30-2006, 05:35 PM   #2
Prpl_Ppl_Etr's Avatar
Join Date: Mar 2006
Location: Vancouver,BC
Posts: 148

I tried to develop a dynamic menu using the same techniques you are, but met with limited success...

An associate suggested the use of an Object Tree.

Now, I didn't know precisely what he meant by that, but it didn't take long to come to grips with the approach.

First, look at the problem in a different way...

Rather than thinking,"Ok, I've got these buttons on the stage and when the user clicks one, I need to move all the lower buttons down, then when the user clicks again I need to remove the extra buttons and move all the other buttons back up into place, etc, etc, etc."

Try this, "Ok I have a list of main menu items to draw on the stage. Where are these items stored? What buttons am I attaching? What are the sub buttons I need to add? etc, etc, etc,"

The main difference is that in the first approach, you are locked into having the 'main' buttons always on the stage and are forced to move them, whereas if your menu is totally dynamic (getting erased and redrawn everytime it is interacted with) and you draw items from a list (when you make the menu), all you need to do is modify the list of items you want to draw, the draw the items on that list.

To do this, you only need to understand two things: The Object Tree structure, and recursive functions.

First you create a tree structure where all your "items" are arranged into a hierarchichal structure: the sub-menu items are child objects of the main-menu items.

If the user clicks one of the 'main-menu" buttons, it "activates" the sub-items (child objects). Then a recursive function is run over the tree structure to 'read' the active items into a list. This is the list of items you will draw to the stage.

If the user then clicks the same button again, the sub-items are 'de-activated', the recursive reader function is called again and the menu is re-drawn.

Using this approach may require a bit more of an initial time investment, but the pay-off is a transferable, scalable, system without the headaches involved with trying to manipulate the positions of all those buttons.

Hope this helps,
Ascii Abe says,
"Design to an interface!"
Prpl_Ppl_Etr is offline   Reply With Quote
Old 10-31-2006, 03:03 AM   #3
Registered User
Join Date: Mar 2006
Posts: 13

Thanks for that, ill have a look into doing it that way
mattzi is offline   Reply With Quote
Old 10-31-2006, 03:01 PM   #4
Registered User
Join Date: Apr 2004
Posts: 135

I paid a few bucks for BounceMenuPro.....it does exactly what you want and all the code and permutations are figured out. Full customizable. I think you get it at faithhornstudios.com
myBad.script is offline   Reply With Quote
Old 10-31-2006, 05:45 PM   #5
Banned by AS.org Staff
Join Date: Oct 2006
Posts: 1,524



Last edited by anonymous; 10-31-2006 at 05:53 PM.
anonymous is offline   Reply With Quote
Old 11-05-2006, 10:23 PM   #6
Registered User
Join Date: Mar 2006
Posts: 13

thank you guys, ill look into it and see what i can do.
mattzi is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic menu winteria ActionScript 1.0 (and below) 3 02-16-2004 05:57 PM
dynamic menu ? Navarone ActionScript 1.0 (and below) 11 01-10-2004 01:51 AM
dynamic menu ? Navarone ActionScript 1.0 (and below) 0 11-07-2003 11:43 AM
Hiding Buttons On A Dynamic Menu systemfx Simple Stuff (Newbies) 4 08-07-2003 05:15 PM
Help with Dynamic Menu Jeremy ActionScript 1.0 (and below) 1 09-12-2002 10:59 PM

All times are GMT. The time now is 02:06 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.