# Events in custom classes

**URL:** <https://forum.kirupa.com/t/events-in-custom-classes/246027>\
**Category:** flash\
**Created:** [December 6, 2007, 1:51pm UTC](https://forum.kirupa.com/t/events-in-custom-classes/246027 "2007-12-06T13:51:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flufferino](https://avatars.discourse-cdn.com/v4/letter/f/f6c823/32.png) [@Flufferino](https://forum.kirupa.com/u/Flufferino)\
**Post date:** [December 6, 2007, 1:51pm UTC](https://forum.kirupa.com/t/events-in-custom-classes/246027/1 "2007-12-06T13:51:32Z")

</div>

Ok I finally realize that I don’t understand how the EventDispatcher works.  
Or, perhaps, not fully understands it anyway.

My problem:  
I’ve created a custom class, lets call it Bounce. Everytime the ball hits the ground it broadcast the event Event.CHANGE as so:

```auto

disp.dispatchEvent(new Event(Event.CHANGE));

```

Where disp is a EventDispatcher created when the class Bounce first is created.

Everything works great if I have once Bounce class object on the main timeline, if I add another one the CHANGE for the first one stops triggering but the last one added works instead.

```auto

var bouncyBall:Bounce = new Bounce();
var bouncyBall2:Bounce = new Bounce();

bounceyBall.addEventListener(Event.CHANGE, handler); // this works now

bounceBall2.addEventListener(Event.CHANGE, handler); // after this line one bounceBall2 responds to the Event.CHANGE

```

Any clues what misstake I’m doing?
