# Fade in set interval Fade out

**URL:** <https://forum.kirupa.com/t/fade-in-set-interval-fade-out/227784>\
**Category:** Uncategorized\
**Created:** [June 2, 2007, 3:31am UTC](https://forum.kirupa.com/t/fade-in-set-interval-fade-out/227784 "2007-06-02T03:31:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jermartin77](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jermartin77/32/3690_2.png) [@jermartin77](https://forum.kirupa.com/u/jermartin77)\
**Post date:** [June 2, 2007, 3:31am UTC](https://forum.kirupa.com/t/fade-in-set-interval-fade-out/227784/1 "2007-06-02T03:31:29Z")

</div>

Update: I have this working now and have adjusted the code accordingly. Still can’t use buttons to tell it what frame to go to though? Any suggestions?

I am trying to write a script that will take an image in a Movieclip fade it in wait for a specified amount of time and then go to the next frame and do the same thing with the next image in a movieclip, so they will act as a slideshow or there will be buttons to tell it to go to the specified frame and fade in to the image.

I am able to get it to fade in show the image for 5 seconds then it doesn’t fade out just jumps to the next frame. Any input would be appreciated and if you help I would love an explanation as well so I can better understand what is happening.

I am using MX04.

This is my code so far for each frame. Its kind a mess now as I am lost but here goes.

var frameNumber:Number = 2  
var myMc = golfmc;  
stop();  
speed = 3;  
myMc.\_alpha = 0;  
myMc.onEnterFrame = function () {  
if (myMc.\_alpha \< 100) {  
myMc.\_alpha += speed;  
}  
else {  
var interval:Number = setInterval(function () {  
clearInterval(interval);  
trace (“Frame 1”);  
myMc.onEnterFrame = function () {  
if (myMc.\_alpha \> 0) {  
myMc.\_alpha -= speed;  
}  
else {  
delete myMc.onEnterFrame;  
gotoAndStop(frameNumber);

```
            }
        }
    }, 2000);
    delete myMc.onEnterFrame;
}

```

}
