# EventListeners! How do I use them?

**URL:** https://forum.kirupa.com/t/eventlisteners-how-do-i-use-them/269856
**Category:** flash
**Created:** [September 2, 2008, 2:19pm UTC](https://forum.kirupa.com/t/eventlisteners-how-do-i-use-them/269856 "2008-09-02T14:19:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![svdelle](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@svdelle](https://forum.kirupa.com/u/svdelle)
#### Post date: [September 2, 2008, 2:19pm UTC](https://forum.kirupa.com/t/eventlisteners-how-do-i-use-them/269856/1 "2008-09-02T14:19:40Z")

</div>

OK, spent days now trying to grasp the concept of event listeners in AS3. No luck yet.  
So I’ll use a simple setup to maybe get some one to explain how to use these ■■■■ listeners.  
I have a Document Class (Main.as)  
I have a MainMenu Class (MainMenu.as)  
I have a ContentViewer Class (ContentViewer.as)  
I have a ContentScroller Class (ContentScroller.as)  
And I could have had a thousand more for that matter …

1. In the Main Class I add instances of all the different classes and add them to the stage.  
Each instance places them selves on stage based on values in their respective constructors.

```auto
var myMainMenu:MainMenu = new MainMenu();
addChild(myMainMenu);

```

… and so forth for all other instances.  
Now, all Classes have ShowMe() and HideMe() methods using a Tween to fade the alpha of it self either up or down.

```auto
 
function ShowMe():void
{
 Tweener.addTween(this, {alpha: 1, time: .25, transition: "easeOutQiunt"});
}
function HideMe():void
{
 Tweener.addTween(this, {alpha: 0, time: .25, transition: "easeOutQiunt"});
}

```

What I’d like to achieve is, when I click the ContentViewer (or a button on this), I’d like to tell the MainMenu to either show or hide itself (maybe based on its own state).  
My question is: How do I trigger the method on MainMenu (that tells it to either hide or show itselt) from the ContentViewer instance?  
Any help on clearing a basic design as this would be appreciated. Or may I’ve just got the whole OOP idea screwed up.
