hide side navigation
    5 most recent
    Web Services
    Library's
    Component's
    Applications
  Tree menu  Flex 2 Guestbook  Videobox  Simple mp3 player  Videoroom  Moving menu  Flash db board reader  Simple photo gallery  Simplecart and External Interface  Email in Flash II  Photo and Video gallery  New Store  Flash GuestBook V2  Flash-db Miniboard  ActionScript dictionary  Private chat with FlashCom  Flash Whois  An online store  Flash RSS reader  Net Tools - Whois in Flash  Flash Message Board  Flash GuestBook  Email in Flash  Sending Custom Ecards  Simple Live Counter with PHP
    Articles
 Read Full Documentation >>

Moving menu (Flash 7 or above)

Sometimes we want our menues to have effects or at least some movement. Many times people have asked about interchange menu items, replacing selected with the old one, or moving in some way so the menu seems "live". This menu follows a very simple rule: The selected item goes to top, and the old selected move to bottom. The rest move upper if they're below selected, that's all. Applying this simple rule and translating into a class that manages the all thing we have a menu simple to use and add to any project. To setup this menu you just need to arrays: one for items text, one for items action. Here's an example:


menu
.setMenu(["Home", "Info", "Catalog", "History", "Boards", "Contact"])
menu.setActions(["frame:2", "uri:http://www.flash-db.com", "function:myFunction", "frame:3", "frame:4", "frame:5"])

The first method setMenu it's simple: just pass an array with the text of each item, you can pass any quantity of items you need. The second method setActions needs also an array with actions to perform that could be one of this three: frame:5 (performs a gotoAndStop(5) in the timeline where the menu is), function:myFunction (call myFunction in the timeline where the menu is) and uri:http://www.someurl.com (performs a getURL in a new window) Of course the argument could vary, and take into account that there are all strings, not objects.

Customization

There's something to note: a rectangle is included as visual feedback for designers. This is really important when working with elements that are based on code, specially if you work in a team. Designers need to manage the layout, and whit out any feedback, they should simply imagine the element, so the only purpose of this rectangle is to manage space at author time. In fact you should resize it based on how many items you want to use. Also, if you want to change the aspect of items, just edit item movieclip on library and modify it. The menu will auto adjust to the height of the item automatically. Also take into account that if you change the base color, you want to change the onPress, onRollOver and onRollOut colors (lines 38, 57 and 60 inside myMenu class)

Here are the example files >> and here is our working movie.

If you have further questions, ask please on Boards