# Two onEnterFrame commands (in separate frames)

**URL:** https://forum.kirupa.com/t/two-onenterframe-commands-in-separate-frames/133619
**Category:** Uncategorized
**Created:** [January 10, 2005, 4:47pm UTC](https://forum.kirupa.com/t/two-onenterframe-commands-in-separate-frames/133619 "2005-01-10T16:47:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jillymo](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@jillymo](https://forum.kirupa.com/u/jillymo)
#### Post date: [January 10, 2005, 4:47pm UTC](https://forum.kirupa.com/t/two-onenterframe-commands-in-separate-frames/133619/1 "2005-01-10T16:47:09Z")

</div>

I have two onEnterFrame functions that run at separate times. The code is on the timeline of a mc that I am using as a mask, and it is controlling an empty mc on my main timeline that is holding a jpeg loaded into my main movie using the loadMovie command.

On the 35th frame of the mask mc timeline, I have this code (to scroll the picture)

\_root.holder.onEnterFrame = function() {  
\_root.holder.\_x += 3;  
}

It works fine until frame 503, where I have this code (to fake that the masking is being used to fade the picture in, I am setting picture alpha to zero, then fading it in)

\_root.holder.\_alpha = 0;  
MovieClip.prototype.fadeIn = function(speed){  
this.onEnterFrame = function(){  
this.\_alpha+=speed;  
if(this.\_alpha \>= 100) delete this.onEnterFrame;  
}  
}  
MovieClip.prototype.fadeOut = function(speed){  
this.onEnterFrame = function(){  
this.\_alpha-=speed;  
if(this.\_alpha \<= 0) delete this.onEnterFrame;  
}  
}  
\_root.holder.onEnterFrame = function() {  
\_root.holder.fadeIn(5);  
}

How would I get the picture to keep scrolling? (because it stops once the new onEnterFrame function is executed)
