My account
Shopping cart
Knowledge base

Using event listeners

1. Open o new file in Macromedia Flash (File>New Document). Drag a drop down 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 dropDownMenu.

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

3. Before you continue with this tutorial please read the Create a Simple Drop Down 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 :

myEventListener = new Object();
myEventListener.onRelease = function(evtObject){
     trace("onRelease event on item: " + evtObject.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.

Download the source files for this tutorial