# Custom events help =(

**URL:** <https://forum.kirupa.com/t/custom-events-help/269790>\
**Category:** Uncategorized\
**Created:** [September 1, 2008, 6:11pm UTC](https://forum.kirupa.com/t/custom-events-help/269790 "2008-09-01T18:11:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoink](https://avatars.discourse-cdn.com/v4/letter/z/9d8465/32.png) [@zoink](https://forum.kirupa.com/u/zoink)\
**Post date:** [September 1, 2008, 6:11pm UTC](https://forum.kirupa.com/t/custom-events-help/269790/1 "2008-09-01T18:11:52Z")

</div>

im making a simple space invader game which has 2 classes called bullet and monsters.

I have a function in the main time line that adds an instance of the bullet class each time the mouse is clicked. There is also a function that adds an instance of the monster class every 3 seconds.

in the bullet class… i have this snippet of code:

if (this.hitTestObject(monster)== true)  
{

```
              addEventListener("enemyHit", testDispatcher);
            dispatchEvent(new Event("enemyHit"));
            
        }

```

the testDispatcher just traces a text so i know that the class is dispatching the event properly

in the monster class, i have this snippet of code:

this.addEventListener(“enemyHit”, removeMonster);

the removeMonster is just parent.removeChild(this);

So what happens is… the dispatchEvent works in the bullet class only… the maintimeline and the instances of the monster class seems to not receive the enemyHit event… How should i do it so that the monster class can listen for the enemyHit event dispatched by the bullet?
