# addEventListener which runs from another class

**URL:** <https://forum.kirupa.com/t/addeventlistener-which-runs-from-another-class/283140>\
**Category:** flash\
**Created:** [March 3, 2009, 1:08am UTC](https://forum.kirupa.com/t/addeventlistener-which-runs-from-another-class/283140 "2009-03-03T01:08:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryrocks](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@ryrocks](https://forum.kirupa.com/u/ryrocks)\
**Post date:** [March 3, 2009, 1:08am UTC](https://forum.kirupa.com/t/addeventlistener-which-runs-from-another-class/283140/1 "2009-03-03T01:08:55Z")

</div>

Hey,

I want to declare addEventListener in a class. But I want the function handler to run from another class.

Is this possible?

Say I have a class Ground.as with the code:

stage.addEventListener(Event.ENTER\_FRAME, animateChar);

Then in Ball.as I have the function:

public function animateChar(event:Event):void  
{ …

Ball.as and Ground.as are in the same directory.

How would I go about this?

Thanks 🙂
