May 22 , 2000

Menu and Title Swapping

This was a test of my patience for sure. I don't have an extensive education in programming, but I can usually get my way around. The below project came about as a serious challenge... and I went in full blast!

Version: 4
 

 
 


Above is the results of a few serious headaches. It may not look like much, but I consider it to be one of my best problem solving projects yet.

The goal: To create a menu system that can be any number of menu items and have it move to the top and act as a Title when pressed. The title would slide out of view to make room for the new menu item.

You may tell yourself "Big deal, this shouldn't be too hard!" I know! that's my initial thought too. But if you think about what's been accomplished here from a technical standpoint, the whole menu system accounts for 5 x 5 variables and having to figure out where you were last in the movie, and where you're going next.

Try to build all the possibilities of going from "About Us" to any of the other menu choices, and vis versa... that would be about 25 different possible combinations! Now try to figure out how to pick and choose each of those variants based on what the user has clicked and where they've been already.


What I've done is made 5 simple labeled parts in one Movie Clip that pass variables from one to the other... then fill in a Text Field for the Title animation.

Above is one of these parts. Each menu item has a unique part of this Movie Clip. About us is "menuSwap1" and so on. When you click on the About Us button, the first action seen above fills in a text box called "menuTitle" with a variable called "lastVisit".

The last action you see in this group, redefines the "lastVisit" variable based on what particular button you are in. Since we are in About Us, the variable will be filled in appropriately. It looks like this:

Set Variable: "lastVisit" = "ABOUT US"
Stop

Since all of the other labeled parts of this movie clip start with this action:

Set Variable: "menuTitle" = lastVisit

The title "menuTitle" will change based on the last place you were. We've instantly hurdled over every possible combination of button clicks and title swaps!

Slick, easy, efficient and it works!

 

Download the Flash (.FLA) file below.

Flash 4 file download

Macintosh Stuffit File menu_title.sit

Windows Zip File menu_title.zip


You are free to use this technique in your Flash movies on one condition. Just send me an email letting me know how you used it so I can see what the world is coming up with using this very cool effect.

If you have any further questions on how it was done, just drop me a note. See my other techniques in Flash:

Ian Kelleigh
Ian@FreeHandSource.com

Visit my site all about FreeHand and see other tips with Flash.