A Menu is Born
That pretty much completes things there. We load XML,
interpret the first node into menu whose items are then
given actions either opening another menu and/or calling
commands from an Actions object. Not too bad once you
think about it.
We can still tweak things a little bit,
though. The attached menuitem movieClip is made out of
movieclips. There are no buttons within it at all.
However, if you use the menu, you'll notice that there
is a rollover effect. This is controlled by
actionscript. It's nothing special, but its good to have
to help keep yourself oriented when using the menu - so
you can visually tell which menu item you're hovering
over more easily. This effect can be added fairly easily
using the color object in some of the events we set up
for each item thereby giving the button rollover effect.
The one thing to be careful of is to not apply the color
to the entire item movieclip. Instead, we can just apply
it to the background clip so the title of that menu item
is still very easily discernable.
- var col = new Color(this.background);
- col.setRGB(0xf4faff);
In the end, the final complete script
looks like the following.
And that, combined with 3 xml files,
menu1.xml, menu2.xml and
menu3.xml, gives you this as a final result.
[ menu
in Flash defined with XML ]
Senocular