midwest web design

Creating a Flash - driven DHTML menu

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 to 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 a DHTML menu. In this article, we will walk through creating a DHTML menu and how to show and hide submenus. In addition, we will consider accessibility issues involved with this type of menu.

If you would like to follow the DHTML 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.

See Demo

Printable Version
Word PDF
Download Project Files
Zip

Advantages/Disadvantages to the menus mentioned

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.

Create the file

Inside Flash, create a new file named menuone.fla by following these steps:

New Flash Document

  1. Leave Flash document selected
  2. Left click OK

Create the following hierarchy:

ActionScript ActionScript
  Stops
  Labels
Button One Top Button
  Sub-Menu
  Sub-Menu
  Sub-Menu
  Sub-Menu
Button Two Top Button
  Sub-Menu
  Sub-Menu
  Sub-Menu
  Sub-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:

Zoom Drop Down List

Create main menu buttons – first and second tier

Since each of the main menu buttons has the same characteristics, we will use "topbutton" from our first tier as our example. Follow these steps to create the button:

Make sure you are on the “topbutton” layer as shown below:

Top Button Layer

In case the text field doesn’t expand to accommodate the text, move the cursor to the top right corner and drag to the right until the text fits inside:

Selection Tool

Button instance

Track as Button

Repeat these steps for the other button, replacing instance and library names where appropriate.

Why Track as menu item?

Often times when placing multiple buttons in a deep hierarchy, such as this one, leaving the default setting for buttons to Track as buttons will cause buttons to stop working. Setting the buttons to Track as menu item fixes the issue.

Create fade sequence for main menu buttons – first and second tier

Since each of the main menu buttons have the same fade sequence, we will use top button from our first tier as our example. Follow these steps to create the fade sequence:

For frame one:

For frame ten:

To complete the fade sequence, follow these steps:

Repeat this process for button two of the second tier from the main menu except position the button at the following coordinate:

We will continue by creating the sub menu buttons in the first-tier.

top of page

Thank you for visiting Fabrizio.com - Come back again soon.