# onEnterFrame help

**URL:** <https://forum.kirupa.com/t/onenterframe-help/297616>\
**Category:** flash\
**Created:** [October 6, 2009, 2:03am UTC](https://forum.kirupa.com/t/onenterframe-help/297616 "2009-10-06T02:03:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Numinus](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@Numinus](https://forum.kirupa.com/u/Numinus)\
**Post date:** [October 6, 2009, 2:03am UTC](https://forum.kirupa.com/t/onenterframe-help/297616/1 "2009-10-06T02:03:00Z")

</div>

I need to use an onEnterFrame event to call a function **just once**. Here’s the code:

my\_object.onEnterFrame = function() {  
if (this.\_y == 100) {  
my\_function();  
}  
};

So say i drag “my\_object” to a y-coordinate of 100, how do i make it so it only calls the function once. Then if i drag the object away from y=100, and then back to y=100, i want it to call the function again.

I’m using the onEnterFrame event b/c i need it to constantly look for the object to be at y=100, maybe except when its actually at 100.
