# onEnterFrame frustrating

**URL:** https://forum.kirupa.com/t/onenterframe-frustrating/40827
**Category:** flash
**Created:** [January 22, 2004, 9:58am UTC](https://forum.kirupa.com/t/onenterframe-frustrating/40827 "2004-01-22T09:58:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Gregory](https://avatars.discourse-cdn.com/v4/letter/g/e56c9b/32.png) [@Gregory](https://forum.kirupa.com/u/Gregory)
#### Post date: [January 22, 2004, 9:58am UTC](https://forum.kirupa.com/t/onenterframe-frustrating/40827/1 "2004-01-22T09:58:38Z")

</div>

hi,  
I have been trying in vain to get my onEnterFrame function working. here’s how it is:

I have my 5 buttons created in a loop where text is added and my button functions are added.

I have this for onRollOver:[“myBtn”+i].

[“myBtn”+i].onRollOver = function() {  
//create pointer mc over button  
var pointer = this.attachMovie(“buttonPointer”, “pointer\_mc”, 21);  
with (pointer) {  
\_x = this.\_width/2;  
\_y = -5;  
this.onEnterFrame = function() {  
if (pointer.\_y\<2) {  
pointer.\_y += 1;  
} else {  
delete this.onEnterFrame;  
}  
};  
this.name\_txt.textColor = 0xFFFFFF;  
}

///////okay, now I have this on my rollOut:

onRollOut = function() {  
this.onEnterFrame = function() {  
if (pointer.\_y\>0) {  
pointer.\_y -= 1;  
} else {  
delete this.onEnterFrame;  
}  
};  
this.name\_txt.textColor = 0x000000;  
};  
};

Okay, now when i roll over my mc the pointer mc is attached and it is moves downwards to the required spot, on rollOut nothing happens. I know i cant have two onEnterFrames on the same mc, and i figure that the rollOut cancels the original but how can i get around this. I mean i still want to place the onEnterFrame where it is, but is there code that will make this work ??

thanks for any help

Greg
