# dispatchEvent in "laymans" terms

**URL:** <https://forum.kirupa.com/t/dispatchevent-in-laymans-terms/299091>\
**Category:** flash\
**Created:** [October 29, 2009, 4:08pm UTC](https://forum.kirupa.com/t/dispatchevent-in-laymans-terms/299091 "2009-10-29T16:08:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brndn](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@brndn](https://forum.kirupa.com/u/brndn)\
**Post date:** [October 29, 2009, 4:08pm UTC](https://forum.kirupa.com/t/dispatchevent-in-laymans-terms/299091/1 "2009-10-29T16:08:36Z")

</div>

Hi all  
I am just trying to get my nut around event dispatchers.  
I can see how they work internally but what I am trying to do is dispatch an event from a subclass back to the document class.

here is what I am trying below but the event is not firing.

```auto

package {
    import flash.display.Sprite;
    import flash.events.Event;

    public class EventDispatcherExample extends Sprite {
         
 
        public function EventDispatcherExample() {
       
            var addBut:addButton = new addButton();
            
                    addEventListener("eventName", actionHandler);

        }

        private function actionHandler(event:Event):void {
            trace("actionHandler: " + event);
        }
    }
}

```

Subclass is

```auto

package {

import flash.events.EventDispatcher;
import flash.events.Event;
import flash.display.*;

public class addButton extends Sprite {

public function addButton():void {

dispatchEvent(new Event("eventName", true));

    }
}
}

```

does anyone have a quick link or example that will show a similar technique

cheers
