# \[AS2\] setInterval in movieclip works, but breaks stop(); throughout scenes

**URL:** <https://forum.kirupa.com/t/as2-setinterval-in-movieclip-works-but-breaks-stop-throughout-scenes/284416>\
**Category:** flash\
**Created:** [March 19, 2009, 12:36am UTC](https://forum.kirupa.com/t/as2-setinterval-in-movieclip-works-but-breaks-stop-throughout-scenes/284416 "2009-03-19T00:36:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xvkarbear](https://avatars.discourse-cdn.com/v4/letter/x/7ba0ec/32.png) [@xvkarbear](https://forum.kirupa.com/u/xvkarbear)\
**Post date:** [March 19, 2009, 12:36am UTC](https://forum.kirupa.com/t/as2-setinterval-in-movieclip-works-but-breaks-stop-throughout-scenes/284416/1 "2009-03-19T00:36:28Z")

</div>

This has given me nothing but problems.

I have a series of 6 images. In a single movie clip symbol (with the pictures embedded/attached in the swf), I want the images to fade in, stop for 4 seconds, fade out as the next image fades in, and repeats from there. I know how to do this with timeline tweens - but I wanted to learn how to make it in actionscript.

I’ve finally been able to make the images do this, but when I pull the movieclip into my main animation, it breaks all my stop(); commands for navigation. it seems to stop for 4 seconds and then continues on.

I’m still very much an actionscript beginner, so I don’t know how to troubleshoot it. Here’s my code, anyone have any suggestions?

[SIZE=4] **Frame 1 of movie clip** [/SIZE]

```auto
inSpeed=7;
outSpeed=7;
photo1._alpha=0;
photo2._alpha=0;
photo3._alpha=0;
photo4._alpha=0;
photo5._alpha=0;
photo6._alpha=0;
photo1.onEnterFrame=function(){
    this.onEnterFrame=function(){
        this._alpha+=inSpeed;
        if(this._alpha>100){
            this._alpha=100;
            delete this.onEnterFrame;
        }
    }
}

```

[SIZE=4] **Frame 2 of movie clip** [/SIZE]

```auto
stop();
pause = function () {
        play();
        clearInterval(pausei);
        delete this.onEnterFrame;
}
pausei = setInterval(pause, 4000);

```

[SIZE=4] **Frame 3 of movie clip** [/SIZE]

```auto
inSpeed=7;
outSpeed=7;
photo1._alpha=100;
photo1.onEnterFrame=function(){
    this.onEnterFrame=function(){
        this._alpha-=outSpeed;
        if(this._alpha<0){
            this._alpha=0;
            delete this.onEnterFrame;
        }
    }
}

photo2._alpha=0;
photo2.onEnterFrame=function(){
    this.onEnterFrame=function(){
        this._alpha+=inSpeed;
        if(this._alpha>100){
            this._alpha=100;
            delete this.onEnterFrame;
        }
    }
}

```

and the frames just repeat from frame 2 to frame 13… where i tell it to go back to frame 2 of the movie clip:  
**[SIZE=4]  
Frame 13 of movie clip[/SIZE]**

```auto
inSpeed=7;
outSpeed=7;
photo6._alpha=100;
photo6.onEnterFrame=function(){
    this.onEnterFrame=function(){
        this._alpha-=outSpeed;
        if(this._alpha<0){
            this._alpha=0;
            delete this.onEnterFrame;
        }
    }
}

photo1._alpha=0;
photo1.onEnterFrame=function(){
    this.onEnterFrame=function(){
        this._alpha+=inSpeed;
        if(this._alpha>100){
            this._alpha=100;
            delete this.onEnterFrame;
            gotoAndPlay(2);

        }
    }
}

```
