My account
Shopping cart
Knowledge base

Using event listeners

1. Open o new file in Adobe Flash CS3 (File>New Document). Drag an accordion tree menu on the stage from the Components palette and set up the menu in the Component inspector. It is very important to set the instance name of your menu to accordionTreeMenu.

2. If you canít find the accordion tree menu component, please see the How to install a MXP file tutorial. If you have trouble configuring your accordion tree menu please see the How to find Help for Jumpeye components.

3. Before you continue with this tutorial please read the Create a Simple Accordion Tree menu tutorial.

4. You will need an xml file for this component to work. You can create your own xml file or you can use this file that Iíve used (called menu_easy.xml).

5. Create a new layer and name it actions. Write the following code :

import com.jumpeye.Events.AccordionMenuEvents;

accordionTreeMenu.addEventListener(AccordionMenuEvents.ITEM_RELEASE, itemReleaseHandler);
function itemReleaseHandler(evt:AccordionMenuEvents):void {
     trace("onRelease event on item: " + evt.item.title);

6. Next hit Ctrl+Enter (Command+Enter on Mac) to test your movie. On every click the output window should display the itemís title. Below is the image of the Output window after Iíve pressed the item labeled ďHomeĒ.

Other event listeners are available on the events help page.

7. Comment out the trace statement and try to load a movieclip using this listener.