# Custom events: Is this a bad thing to do?

**URL:** <https://forum.kirupa.com/t/custom-events-is-this-a-bad-thing-to-do/330572>\
**Category:** flash\
**Created:** [February 11, 2013, 4:24pm UTC](https://forum.kirupa.com/t/custom-events-is-this-a-bad-thing-to-do/330572 "2013-02-11T16:24:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpann](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tpann](https://forum.kirupa.com/u/tpann)\
**Post date:** [February 11, 2013, 4:24pm UTC](https://forum.kirupa.com/t/custom-events-is-this-a-bad-thing-to-do/330572/1 "2013-02-11T16:24:33Z")

</div>

Say I’m building a thing with a main class and several child classes:  
[LIST]  
[_]City  
[_]Block  
[_]Building  
[_]Floor  
[/LIST]  
Is it bad practice to dispatch the same custom event type upward from the bottom-most child to the top-most, like this:

```php

// City
block = new Block();
block.addEventListener(CustomEvent.FOOBAR, blockEventHandler);
function blockEventHandler(c:CustomEvent) {
   // so something
}
// Block
building = new Building();
building.addEventListener(CustomEvent.FOOBAR, buildingEventHandler);
function buildingEventHandler(c:CustomEvent) {
   dispatchEvent(new CustomEvent(CustomEvent.FOOBAR));
}// Building
floor = new Floor();
floor.addEventListener(CustomEvent.FOOBAR, floorEventHandler);
function floorEventHandler(c:CustomEvent) {
   dispatchEvent(new CustomEvent(CustomEvent.FOOBAR));
}
// Floor
dispatchEvent(new CustomEvent(CustomEvent.FOOBAR));

```

Just to clarify, notice that in each of the three child classes I’m dispatching the same type of custom event.

Or is it better to create a different event type for each?
