# Delete this.onEnterFrame

**URL:** <https://forum.kirupa.com/t/delete-this-onenterframe/242251>\
**Category:** Uncategorized\
**Created:** [October 24, 2007, 2:35am UTC](https://forum.kirupa.com/t/delete-this-onenterframe/242251 "2007-10-24T02:35:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Booger](https://avatars.discourse-cdn.com/v4/letter/b/90ced4/32.png) [@Booger](https://forum.kirupa.com/u/Booger)\
**Post date:** [October 24, 2007, 2:35am UTC](https://forum.kirupa.com/t/delete-this-onenterframe/242251/1 "2007-10-24T02:35:09Z")

</div>

Hi all,

Having a problem with deleting an on.EnterFrame (code below and trace output). Obviously what is happening is that it stuck in a continual loop and it is not even hitting the ‘else if’ and continues until user activates ‘teal5\_mc.onPress’. I am probably doing something very obvious but I have been looking at the code too long…  
Also, if anyone knows of a better way of including a sound to the rollover that would be bonus. Creating a mechanical sliding door sound effect to reveal a link to another site underneath that door.  
The whole fla is working currently but obviously the sound loops and is distorted and not good practice to have the continual loop

Cheers,

Dave

//Teal 5 Intertia variables  
var teal5up = -450;  
var teal5down = 0;

//inertia formula and sound attach  
teal5\_mc.onRollOver = function() {  
if (teal5\_mc.\_y\>-445){  
this.onEnterFrame = function() {  
this.\_y = this.\_y+((teal5up-this.\_y)/16);  
sound1.attachSound(“Servo01.mp3”);  
sound1.start(0,1);  
trace(teal5\_mc.\_y);  
};   
}else if (teal5\_mc.\_y\>=-445) {  
delete this.onEnterFrame;  
};  
};

teal5\_mc.onPress = function() {  
if (teal5\_mc.\_y\<0){  
this.onEnterFrame = function() {  
this.\_y = this.\_y+((teal5down-this.\_y)/16);  
};  
}else if (teal5\_mc.\_y==0) {  
delete this.onEnterFrame;  
};  
};

Output Panel displays from trace  
-448.85  
-448.9  
-448.95  
-449  
-449.05  
-449.1  
-449.15  
-449.2  
-449.25  
-449.25  
-449.25  
-449.25 And continues until user activates ‘teal5\_mc.onPress’
