Page 1 of 1
This user is yet to take control of their account and provide a biography. If you are the author of this article, please contact us via support AT actionscript DOT org.View all articles by FlashJunkie
Written by: Flashjunkie
Difficulty Level: Advanced
Requirements: Flash 4
Here is a sliding menu system that works via Duplicate Movie Clip.
- When you start, you set up the names of the menus you want. (Look at the variables in Frame 1). You can add as many as you want and it will work.
- THEN, you name the first frame in a new scene after the menu item. (Look at frame 1 of each scene). When you click on these buttons, Flash takes the name of the menu and performs a GOTO FRAME (Named after the button).
There are a lot of comments in here to explain any of the tricky parts. Basically, if you understand duplicate movie clip, the naming of variables (text boxes) and referring to objects outside their own timelines.... this shouldn't be too too difficult to grasp. There's a little algebra involved in duplicating the movie clips horizontally.
There are a few catches to this menu system:
- At any given time you can see a certain amount of menus on the screen. Say that you can see 5. The way this system works is Flash duplicates TWICE as many movie clips as there are menus and puts them to the right. While it scrolls left, this is a good thing. Then when you scroll things to the right, those disappear and Flash duplicates another set to the left.
NOW.... what if you only have 2 menu items? Things will look kind of silly won't they? So don't do that! (You can try this by setting the variable "tmi" (total menu items) in Frame 1 to "2" and see what I mean.)
- It seems to work kind of slow in some browsers? (uncertain of this). I originally created this to be used as part of a much larger interface on a CD-ROM. When you set the frame rate to 120FPS in Flash, you get much smoother scrolling than if you leave the Frame Rate at ... say ... 24. Try it. Off a CD-ROM it works perfectly.
The whole thing is fairly tidy but certainly on optimized in terms of using the least amount of code or items to do this. That's because this was my first Flash project and I'm no programmer. Hey, this took me a couple of solid weeks to get it to work right the first time! If it's messy from a programming point of view that's why.