January 10th 2008 - Entry Posted to:
ActionScript 3
This menu system was written as a means to display images or other content in a condensed manner.
Class based ActionScript 3 Accordion Menu, with either a rollOver/RollOff activation scheme for a onRelease activation scheme. Menu is built using a custom event dispatch scheme to keep each menu item synchronised with the changing states of the menu. The menu grabs a reference to the Stage via the ADDED_TO_STAGE event, which is uses as its base for setting up the communication between menu elements.
Menu Functionality
Support for Images and Swfs as content.Swfs can contain their own interactivity.Either Click or MouseOver menu to activate it.XML Driven.XML can contain function calls with parameters, or URLs or nothing.Menu Highlighting is an option.Either the whole menu item, or just the menu bar can be used to trigger menu movement.Menu supports content of differing sizes. Menu will auto size the menu bar width, but is content height agnostic.Support for placement.Support for spacing between menu items and menu bar item height.Menu Bar has a test element, pulled in from the XML file.Column support. But you will have to add that change yourself.Menu uses either tweenLite or tweener for menu movement.Custom Event Dispatch class for sending events to particular menu instances. Eg, for telling one menu to slide open after all have loaded.Class has a reset method, should you need to reset the menu
If you are going to get the menu to trigger events it is generally it is better to only use the bar, so as to not interfere with your other nested actions.
Menu is a class file, which relies on be passed three values in its constructor,?Ǭ† (loader content, title text, menu action), all of which are values that are pulled in from the XML file.
Included in the download are two folders, one?Ǭ† accordianAS3_rel contains the onRelease version of the class. The other, accordianAS3_roll contains the RollOver version of the class. In each folder are each classes respective Flash CS3 document, its associated Document Class file, an XML file, an XML parsing class, the tweenLite Class and images and swfs.
Updates10th Feb, 2008: Added custom event dispatch class to both examples.
View ExamplesActionScript 3 XML Accordion Menu: On Release VersionActionScript 3 XML Accordion Menu: On RollOver Version
Source FilesHere are the source files; ActionScript 3 XML Accordion Menu V2
DependenciesClass uses the tweenLite tweening class for menu movement, highlighting etc; http://www.tweenlite.com