Home > Articles > Graphics & Web Design > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Customize the Navigation Bar

There are many graphic elements that you can customize to fit the look and feel of your site, but there are several items that you must modify so that the navigation bar will work with the rest of the movies. You will also need to alter the number and name of the buttons so that the navigation bar is appropriate to your site. The options for changing the look of the navigation bar are placed at the beginning of this section, but you'll should make the modifications to the number and name of the menu items before you modify the aesthetic elements so you don't spend time modifying an element you may delete.

The Background, Color, and Shape

Changing the background color of the Navigation Bar movie itself won't affect the navigation bar. It will be loaded into a level inside of another movie, and that information will be striped off when it's imported into the secondary movie. The symbol titled hn_NavBarShell contains the color and shape of the navigation bar itself, the color of the background and outline can be edited easily with the stroke and fill options in the Tool palette. You can also change the shape, but make sure the subsequent elements are adjusted to fit this new configuration.

The site that I am creating has a high-energy feel, so a gray and blue navigation bar is too sedate and low key for my purposes. I've chosen a warm palette for the navigation bar for my friendly robot manufacturer. After I modified the number and names of my buttons, I used the stroke and fill options to choose the Web safe browns, greens, and oranges that now make up my navigation bar.

Figure 3.4 Timeline of the hn_NavBarShell graphic symbol with new colors and Movie Background color set to white.

Forward and Reverse Buttons

You can change the shape, color, and size of the Forward and Reverse buttons by editing the button symbols hn_left and hn_right. You can also create or import your own graphics to construct a button. If you create a new button, it's best to use the Instance panel to swap out the instance of the symbols in the Timeline. If you delete and replace the buttons, you'll lose the code that's attached to those instances, and the sliding action will no longer function.

I created a new set of graphics for the Forward and Reverse buttons using the drawing tools available in Flash. I decided that the current buttons have too much of a hard technology edge for my lay out, and that I want my buttons to be simple and friendly. After I created my arrows, I swapped out the graphics in the hn_left and hn_right button symbols and used the fill option to change the darker yellow to a lighter yellow on rollover.

Figure 3.5 Timeline of the modified hn_left button symbol in edit mode on the Stage.

Main Menu Buttons

You may want to change the font face and text point size of the buttons. It's easiest to do this straight from the Library rather than on the Stage. The buttons for each category are inside of the folders titled with their category. For example, the button for the main menu Cart button is inside the folder titled hn_cart_elements. You can go down the list and make sure that you've made the same alterations to every button. You can also change the background color of the rollover state as easily as you would any symbol.

Figure 3.6 The hn_cart_but button located in the hn_cart_elements folder as it appears in the library.

I needed to make sure that the text in my buttons was legible against the new background color of my navigation bar. The provided font face is Arial and, for me, this choice still makes sense because it's straight forward and easy to read. However, the font face color is light gray, which now looks faded in comparison to my new colors. So I changed the font face to white. The font face color in the rollover state is blue with a gray background; this looked muddy in my new navigation bar so I change the font face color to black with a white background.

Sub-Menu Buttons

You will need to change a few lines of code in the sub-menu section so that your buttons will load the correct movies. It will also be necessary to change the number and labels of your sub-menu buttons to reflect your site navigation. You'll have the option of changing many of the graphic elements and transition animations for the buttons, but it's best to make the changes to the look and feel of the buttons after you have adjusted the number of sub-menu items to avoid creating more work for yourself than is necessary.

Appearance

You can easily change the background colors of the sub-menu buttons because they all use the same two graphic symbols. This means if you change the background color in the master symbol of the Up state for one sub-menu button, all of the buttons backgrounds are updated with the new color. The same is true for the background of the Over state of the button. Remember that the labels sit on top of the buttons inside the sub-menu Movie Clip. You will need to change the names of the sub-menu items to reflect your products and services. (We'll get into the specifics of that later.) The default alignment of the text on top of the buttons is set to centered. You may prefer that the text align left or right. You can change the font and color of the text, but keep in mind that you'll need to do this for every button; there's no shortcut for this procedure. Edit the text directly on the Stage so that you can see how your changes will look in the context of the entire layout.

I chose to change my backgrounds for the button in the mouse up position from blue to chartreuse and the color of the mouse down background from green with a black arrow to yellow with a black arrow. I left the font choice and font face color of the button alone.

Sub-Menu Button Links

The purpose of the sub-menu buttons is to provide users with a way to get to the category that interests them. The sub-menu buttons are set up with the code you'll need to load these new Flash movies into the current location. The code is attached to the buttons in the Sub-Menu Movie Clips; these Clips are titled hn_"category"_sub: For example, the demos Sub-Menu Movie Clip is titled hn_demos_sub. To view the script you need to click the background of the button itself because the text label sits on top of the actual button. When you look at the code it reads as follows:

/*
To change the movie that loads when the button is clicked, change the name of the swf,
and the level, if desired.
Don't forget to uncomment the code below when you have made your changes.
*/

on(release){
 _parent.gotoAndStop(1);
 //loadMovieNum ("media.swf", 0);
}

Figure 3.7 Timeline of the modified Sub-Menu button in edit mode on the Stage.

As the comments indicate, you'll need to change the name of "media.swf" to the name of your .swf movie to ensure your movie will be loaded on the mouse event. You will also need to remove the // marks before the loadMovie command so that Flash recognizes the script as code and not a comment.

Changing the Pop-Up Menu to a Drop-Down Menu

Because the navigation bar is draggable, the user can place it anywhere they'd like in the movie at run time. You have the option to change the direction of the sub-menu animations from a pop-up to a drop-down menu. To change the direction to a drop-down menu, you'll need to enter each Sub-Menu Movie Clip and move the button instances and text label on the Stage so that the buttons appear below the navigation bar instead of above it. For this task it's best to use the Info panel to adjust the X and Y coordinates. You could move the button groups, made up of the button instances and text, by hand, but using the Info panel will ensure that the button groups are aligned with accuracy. Adjust the Mask layer in the hn_NavBarScroller Movie Clip to cover the new coordinates so that your Sub-Menu buttons won't vanish or appear cut off.

I've chosen to modify my sub-menu items from the pop-up to the drop-down style.

Figure 3.8 Timeline and Stage screenshot that shows final location of drop-down change.

Changing the Number of Main Menu Items

This movie is a model from which you'll base your Flash site. It's doubtful that the main menu items provided will match your information. You may want to add or subtract items to or from the list. We've already covered renaming the buttons. Adding and subtracting items, however, takes a bit more effort. Let's begin with subtracting items.

Subtracting Main Menu Items

It's best to subtract items from the end of the list because it makes adjusting the slide animation easier.

  1. Double-click the hn_NavBarScroller Movie Clip in the Library. This can be found in the folder titled NavBarScroller which, in turn, is inside of a folder called hz_navigation.

  2. Scrub the play head over keyframe 22 of the Scroll layer and double-click the Stage over the navigation bar. You'll find yourself in the edit mode for the hn_menu symbol.

  3. Start with the last menu item on the right and delete as many Movie Clip instances as it takes to get to the correct number of items for your movie.

  4. Go back to the hn_NavBarScroller Movie Clip and look in the Timeline. The top layer titled Labels tells us where important keyframes are located. These labels indicate the direction that the navigation bar will move when the forward and reverse buttons are clicked at run time.

  5. Click the keyframe in the Scroll Layer that falls in front of the 3-2 label. Use the Info panel to adjust the X coordinate so that the last item in the list sets in the last space on the right side of the navigation bar.

    NOTE

    Note: Using keyframe labels is the simplest way to mark off a certain spot in the Timeline when you need to use code to refer to events. If this navigation bar didn't use the labels, your button code soon would because a cryptographer's dream of frame numbers—you'd have to write yourself a cheat sheet to keep track of what was happening, when, and where.

  6. Place the play head in between the frames labeled 3-2 and 2-1, and remove four or five frames (Shift + F5). Remove the same number of frames from the Scroll Layer between 2-3 and 3-2 labels.

This will shorten the time that it takes the menu items to tween across the bar. If you didn't compensate for the fewer number of items, the slide in the last section will appear much slower than the slide through the first two positions.

Adding Main Menu Items

As an example, let's add a category titled Tricks.

  1. Add a new folder to your Library inside of the folder NavBarButtons, and name it the same as your new category so you can spot it easily. Mine is called hn_tricks_elements.

  2. Open up the folder above it. In this case, that folder is hn_tips_elements. Using the Duplicate feature in the Options menu of the Library, duplicate all three symbols that you find in that folder: the button, the Main Item Movie Clip, and the Sub-Menu Movie Clip. Rename the copies of the duplicated symbols with your new category name. For instance, I've named my symbols hn_tricks_but, hn_tricks_mov, and hn_tricks_sub. Move them into the folder you created to hold these elements.

  3. You will need to make sure that the symbols in your new category are updated to reflect your new category. When you duplicated your hn_"category"_mov, an instance of the previous category's Sub-Menu Movie Clip was inside of the Movie Clip. You will need to replace this Sub-Menu Movie Clip instance with an instance of your new Movie Clip. Double-click the hn_"category"_mov Movie Clip in the Library. Lock down all of the layers except the Sub Menu layer, and move the play head to frame 2. Click once on the Stage on top of the instance of the Sub-Menu Movie Clip. Use the Swap Symbol tool in the Instance panel and chose the new Sub-Menu Movie Clip. In my case I swapped the symbol instance of the Movie Clip hn_tips_sub with an instance of the Movie Clip hn_tricks_sub. If I hadn't done that, my Main Item Movie Clip hn_tricks_mov would still be referencing the instance of the Sub-Menu Movie Clip hn_tips_sub.

  4. Double-click the new button symbol that you've just made in the Library and modify the text on the button to reflect the name of your new main menu category. In my case the new name is Tricks.

  5. Return to the Library, double-click your Sub-Menu Movie Clip and modify the Movie Clip to reflect number of items from which you'd like the user to choose and their names. (See the section, "Changing the Number of Sub-Menu Items," for information on adding or deleting Sub-Menu buttons.)

    Figure 3.9 The Library showing new elements and how they should be organized.

  6. Return to the hn_NavBarScroller Clip, and scrub the play head across the Timeline until it's over keyframe 22. Double-click the Stage on top of the navigation bar. This places you in the hn_menu graphic symbol.

  7. Place an instance of the new Clip in the hn_menu symbol on the Stage at the same Y coordinate of the other Clips and at an X coordinate approximate 130 pixels to the right of the last item on the list.

  8. Return to the Timeline in hn_NavBarScroller Clip and go to keyframe 22 in the Scroll layer again. Click on that keyframe and use the Info panel to change the X coordinate of the hn_menu symbol so that the hn_menu symbol shifts to the left until the new category appears at the to the right at the end of the list.

    Figure 3.10 The new main menu button placement in context of the navigation bar.

  9. Now you'll need to compensate in the animation time for the longer list. Add four to five frames (F5) to all of the layers between the labels 3-2 and 2-3.

Changing the Number of Sub-Menu items

It's unlikely that each sub-menu button fits your needs. You will need to either add or subtract buttons to the sub-menu animation to reflect the number of movies the user has the option of viewing.

Subtracting Sub Menu Items

I've chosen the Sub-Menu Clip for the demos section as my example.

  1. Double-click any of the sub-menu Movie Clips in the Library. In this example, it's hn_demos_sub.

  2. The top layer of each sub-menu Clip begins with an Actions layer and is followed by one layer for each button. Delete the first and second button layer under the Actions layer.

  3. Move the keyframe in the Actions layer that contains the stop() script so it's over the last keyframe of animated buttons.

  4. Delete all of the keyframes that extend past the stop action keyframe.

    Figure 3.11 The Timeline after the button has been taken out and adjustments made.

Adding a Sub Menu Item

Let's add a button to the Sub-Menu Clip. I've used the Company section as an example.

  1. Double-click any of the Sub-Menu Movie Clips in the Library, such as hn_company_sub.

  2. Add a new layer under the Actions layer; then add one frame (F5) to the end of each of the existing layers, so that all layers exist for the same length of time.

  3. Place a blank keyframe (F6) in the last frame of your new layer. Name the layer after your new button category. In this case the layer will be named Mission Button.

  4. Copy the button and text field from the frame below and paste an instance of both in the blank keyframe at the end of your new layer. Use the Info palette to align them—the X coordinate will remain the same, but the Y coordinate will be 17 pixels from the closest button instance.

  5. Change the text field to reflect the name of your new category. Change the ActionScript to include the name of the Flash Movie that will be loaded when the viewer clicks it.

  6. Move the keyframe with the stop() script to the last frame of the layer.

  7. Go to the bottom Background layer and extend the boundaries of rolloff background button to include the new sub-menu item.

    Figure 3.12 Timeline when a Sub-Menu button has been added.

  • + Share This
  • 🔖 Save To Your Account