# How to write an eventdispatcher

**URL:** <https://forum.kirupa.com/t/how-to-write-an-eventdispatcher/221129>\
**Category:** Uncategorized\
**Created:** [April 1, 2007, 7:48pm UTC](https://forum.kirupa.com/t/how-to-write-an-eventdispatcher/221129 "2007-04-01T19:48:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qpixo](https://avatars.discourse-cdn.com/v4/letter/q/c4cdca/32.png) [@qpixo](https://forum.kirupa.com/u/qpixo)\
**Post date:** [April 1, 2007, 7:48pm UTC](https://forum.kirupa.com/t/how-to-write-an-eventdispatcher/221129/1 "2007-04-01T19:48:28Z")

</div>

How to write as2.0 using class to respond a simple event handler for several mc’s ?

Just as simple as :

button1.onPress = function() {  
trace(“hello!”);  
}

button1.onRollOver = function() {  
this.gotoAndStop(1);  
}  
…

does anyone have some good examples of using eventDispatcher method in a class?
