Ryan currently works as a Web Developer/Programmer. His skill sets include HTML, CSS, Flash, JavaScript, ASP, ASP.NET, PHP and database technologies. He is also founder of Midwest Web Design.A critical issue to decide when developing websites is what navigational menu will be used. First you need to decide how the menu will fit into the proposed layout, for example in a horizontal or vertical format. Next, you need decide what type of navigational menu will be used such as: JavaScript-based rollovers, CSS - styled list menus, or menu creation tools which provide a variety of options, automate creation of the menu and are easily customized.
Often times, one doesn't think of using Flash to create a navigation system. However, if Flash is properly implemented it can provide an interactive option beyond the capability of HTML and CSS. One example is the halo menu. In this tutorial, we will walk through creating a halo menu and how to show or hide submenus. In addition we will consider accessibility issues involved with this type of menu.
If you would like to follow the halo menu's step-by-step development, or even try your hand at creating a menu as you progress through this article, you will find the project files link helpful.
It is probably safe to say that no menu presented today is perfect, at least from a code-based perspective. For example, if you use a menu system with CSS and JavaScript you may discover that if:
When using Flash to create a menu, the following can also be problematic:
From here you can see that it is critically important for you to consider your website's intended audience. Once all factors have been accounted for, choose the navigation system which best suits your needs. For this article, we will choose the Flash-based option. Let us begin.
Inside Flash, create a new file named halomenu.fla by following these steps:

Create the following hierarchy:
| Folder | Layer |
| ActionScript | |
| ActionScript | |
| Stops | |
| Labels | |
| Main Header | |
| page header | |
| Top Buttons | |
| home | |
| services | |
| gen info | |
| tutorials | |
| Services Submenu | |
| main menu | |
| Gen Info Submenu | |
| main menu | |
| Tutorials | |
| main menu |
As you can see, folders are on the left and layers are on the right. Assign colors to your folders and layers as you desire. Make sure you reduce the magnification to 50% through the zoom drop down list:

Let's create our page header first, since it's the easiest. Navigate to the page header layer:



We'll examine the details on how this works a little later in this article, but for now:


For our purposes, four buttons make up the main menu. The only difference between these buttons is their X-Y coordinates. As a result, we will use the Home button as our example for the creation process. Follow these steps in the Home layer:
Next, with the object selected:


Repeat this process for Services, General Information, and Tutorials, replacing instance names in the library and on the stage in the corresponding Instance text boxes.
Once completed, change the coordinates for each button as follows:
When the movie loads, we want the page header as well as our four main menu buttons to fade in until frame ten. While we have this completed for the page header, we need to complete the process for our buttons. Since the process is the same for all buttons, we will use Home as our example:
For frame one:
We will create a motion tween for each button to fade in smoothly as follows:

Repeat this process for the remaining menu buttons.
Finally, in the Stops layer:
Currently,
when the movie loads, it begins at frame one, plays to frame ten, and
loops. To prevent this we insert the stop command at the end of the
frame sequence, frame ten in this case.
Save your file, and refer to halomenu_start.fla from the download if you need to compare.
Since each of the submenu buttons are the same except for stage positioning, we can use the Services submenu as a template for the creation process. First, we create an empty movie clip to hold our submenu buttons. On the main menu layer under Services sub menu:

You will return to the main timeline. Make sure you are on frame ten. From the library, position the movie clip on the stage:
With the movie clip selected, in the Instance text field under Properties:

With the movie clip selected, double-click it to enter symbol editing mode, and create a hierarchy:
| Folder | Layer |
| Action Script | |
| Action Script | |
| Stops | |
| Labels | |
| Services Navigation | |
| consulting | |
| freelance | |
| hosting |
Since our submenu buttons differ only in position placement, we will use Consulting as our template. In frame two:

You should return to the services submenu. In the library window:
In the symbol window:
In the library, double-click the graphic and you will see that we have four key frames.

This is because when we converted our button to a graphic, Flash retained our button's four states. We don't need these, so delete frames two through four. Click the blue background arrow to exit symbol editing mode:

You should return to the main timeline. Ensure you are on the correct layer in the main timeline and create two additional submenu movie clips using these coordinates:
General Information Submenu
Tutorials Submenu
Follow the same steps to create the remaining submenu buttons and graphics for Services, General information and Tutorials using the following coordinates (note that some of these coordinates are negative numbers):
Services
General Information
Tutorials
Save your file and use halomenu_submenu.fla as a comparison.
When a visitor moves the cursor over one of the main menu buttons, we want the submenu buttons to fade in. Since the fade sequence is the same for all submenu buttons, we use the services submenu buttons as our example. To create the fade sequence for the buttons:
For key frame six:

Save your file and use halomenu_submenu_fadein.fla as a comparison. Repeat this process for the remaining submenu buttons.
When a visitor moves the cursor over a main menu button, the appropriate submenu will fade in below. When the visitor rolls onto another main menu button, the old submenu should fade out and the new submenu should fade in. Since each of the Services submenu buttons has identical properties, we use the consulting button as our template for creating the fade out sequence. To create the sequence:
For key frame eleven:
For key frame seven:

Repeat this process for the remaining submenu graphics. To prevent the fade out sequence from looping continuously:
Save your file and use halomenu_submenu_fadeout.fla as a comparison.
In order for the submenus to show or hide, we need to set two frame labels, one set to show and the other set to hide. We use frame labels so that we can move frames containing content without breaking our code. For example, if we instruct a submenu to show by using a frame number…
[as] servicesBtn.onRollOver=function(){ servicesmc.gotoAndPlay("10"); } [/as]…and then move the show sequence to another frame number our code will not work. Using frame labels solves this issue. To add frame labels to show our submenus, make sure you are inside the services submenu:

Then, to hide this menu:

Repeat these steps for the remaining submenus. Save your file and use halomenu_showhide.fla as a comparison.
To determine which menu we want to show, we assign a value to a variable. Since we are dealing with the services submenu, we set the variable, menuOpen (created later); to services in key frame two of the action script layer by following these steps:
Click the blue background arrow to exit symbol editing mode, and you return to the main stage.
Continuing, make sure on the action script layer, in frame two, you change the value of the variable (menuOpen) inside the general information and tutorials movie clips to the following:
[as]_parent.menuOpen="geninfo";[/as]Save your file, and remember that you can use halomenu_menushow.fla as a comparison.
Though the reasoning requires some explanation, the answer is scope. You can hide the button's visibility on the stage, but it's still active. When a visitor moves the cursor over one of the main menu buttons, the corresponding submenu appears; the submenu movie clip is in scope to the rest of the movie. Thus, when the cursor hovers over to another main menu button the previous submenu hides. At this point, if the cursor moves over to where the services submenu resides the mouse pointer would change to a hand, which would be an awkward response.
We prevent this from happening by using a graphic symbol. By duplicating the button, we acquire the same font family and size, and by deleting frames two through four we eliminate the other states associated with the button. By placing the graphic symbol instead of the button in the hide sequence, we create the illusion that the button has disappeared when the sequence plays. The graphic symbol is still in scope, but graphic symbols don't exhibit button behavior, so this technique eliminates any potentially confusing behavior.
There are two reasons. First, we don't want our submenu buttons in scope or to show until the visitor moves the cursor over the main menu buttons. Without a stop command, when the movie loads, all three submenus will show once the play head in the main timeline hits frame ten. Therefore, we place a stop command on key frame one inside each movie clip. We can't instruct the submenu movie clips to play in the same key frame because there would be conflicting commands; you can't instruct the play head inside the movie clip to play and stop in the same key frame. So we placed the submenu buttons in key frame two.
Since we have completed the user interface, let's review briefly the menu's intended behavior. When the movie loads, we see the page header and four main menu buttons fade in. As we move the cursor over each main menu button, the appropriate submenu shows. Further, as we cursor over the services submenu, and then over tutorials, we see the services submenu hide and the tutorials menu show. Continuing, if a submenu is visible and the visitor moves the cursor over the Home button, the currently visible submenu will be hidden. We use conditional logic to accomplish simple toggling behavior.
So here is how it's done. First, we add some action script to show each submenu. From the main timeline, select the action script layer in frame ten and follow these steps:
We use the onRollOver method of the button, specify which movie clip (such as services submenu), and use the gotoAndPlay method of the movie clip, followed by a parameter, in this case, show. Recall, show is the name of the frame label associated with playing the show sequence which shows the submenus. Save your file and use halomenu_menushow_stepone.fla as a comparison if you like.
To hide our submenus when another main menu button is hovered over, add the following code:
[as]var menuOpen:String="close"; function isitOpen(){ if(menuOpen=="services"){ menuOpen="close"; servicesmc.gotoAndPlay("hide"); } else if(menuOpen=="geninfo"){ menuOpen="close"; geninfomc.gotoAndPlay("hide"); } else if(menuOpen=="tutorials"){ menuOpen="close"; tutorialsmc.gotoAndPlay("hide"); } }[/as]Let's examine this code in greater detail:
Remember, inside our submenu movie clips, for frame two in the action script layer, we set the value of menuOpen to the appropriate submenu. As a result, when the movie loads and the cursor hovers over a main menu button, such as services, the show sequence plays. Subsequently, menuOpen is set to services; the first if statement is true; the variable is set to close and the hide sequence plays. Remember, we hide any submenu which might be visible when moving the cursor over the home button by adding the following to the rollover method:
[as]homeBtn.onRollOver=function(){ isitOpen(); } [/as]We call the function isitOpen, and its job is to determine if any submenu is showing. If so, the submenu hides. Save your file and preview the results. Hover over any of the main menu buttons, and then hover over Home; the appropriate submenus should hide. For an example, visit:
http://midwestwebdesign.net/tutorials/flash/halomenu/halo_menu_stepthree.html
Save your file and use halo_menu_stepthree.fla as a comparison if you like.Currently, hovering over services will show its submenu. However, hovering over general information or tutorials will show their submenus while the existing services submenu remains visible; it should be hidden, right? To fix this, for each button we add the following:
[as]Here's how it works:
The reason for calling the function first is to hide the immediately previous submenu before showing the next submenu, such as when the visitor cursors over services, then over tutorials. How are we hiding the services submenu? Recall that when we declared our variable, we assigned a value of close. If menuOpen's value is equal to services, we know the submenu is visible and that menuOpen is now set to a value of close. We can check the value of one variable for three different values and implement a show/hide toggle behavior by using the logical OR operator, which uses the double pipe (||) in action script.
After the function call, we instruct the appropriate movie clip, in this instance, services, to play the show sequence. You might find the logic here a bit odd, since we are instructing all submenus to be hidden first, and then we instruct the services submenu to show. Our reason is simple; we are ensuring that only the correct submenu will show on a main menu button rollover. For the other two main menu buttons, we alter the last if statement for General Info:
[as]geninfoBtn.onRollOver=function(){And for Tutorials:
[as]tutorialsBtn.onRollOver=function(){For each button we change the last two checks on the menuOpen variable as appropriate. Thus, for the general information button the last two checks on menuOpen need to be services and tutorials. For the tutorials button, change the last two menuOpen checks to services and geninfo. Save your file and preview the results; at this point your menu should be fully functional.
Since our library at the moment is disorganized, let's move our work into a logical folder scheme. Use the New Folder icon:

Create the following folders and place the corresponding symbols as follows:
You can see the completed work here:
http://midwestwebdesign.net/tutorials/flash/halomenu/halo_menu_finished.html
In this article we learned how to use Flash to create a simple halo menu. We also learned a bit about:
Take what you learned here and customize your halo menu to your heart's content!
If you have questions, please follow the link below.