# \[tough\] Any way to declare a custom event?

**URL:** https://forum.kirupa.com/t/tough-any-way-to-declare-a-custom-event/267695
**Category:** flash
**Created:** [August 4, 2008, 8:52pm UTC](https://forum.kirupa.com/t/tough-any-way-to-declare-a-custom-event/267695 "2008-08-04T20:52:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![REEF](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@REEF](https://forum.kirupa.com/u/REEF)
#### Post date: [August 4, 2008, 8:52pm UTC](https://forum.kirupa.com/t/tough-any-way-to-declare-a-custom-event/267695/1 "2008-08-04T20:52:17Z")

</div>

Hi,

This might be extremely hard to do or not even possible (as far as I know), but I was wondering if anybody had any code that allowed users to define they own “event” and add a listener for it.

For example (in pseudo code):

```auto
event footToGround 
   code here that detects if players foot mc has tounged the ground mc
}
function fTG {
   trace("foot has touched ground");
}
stage.addEventListener(footToGround, fTG);

```

This would eliminate the need for onEnterFrame for constant detection and enhance the performance of a game or website with the less and less onEnterFrames, timers or setIntervals that are used on a Flash application.
