# Help With Fade-in / Fade-out at Timed Interval

**URL:** <https://forum.kirupa.com/t/help-with-fade-in-fade-out-at-timed-interval/177734>\
**Category:** flash\
**Created:** [February 4, 2006, 6:22pm UTC](https://forum.kirupa.com/t/help-with-fade-in-fade-out-at-timed-interval/177734 "2006-02-04T18:22:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DirtyApe](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@DirtyApe](https://forum.kirupa.com/u/DirtyApe)\
**Post date:** [February 4, 2006, 6:22pm UTC](https://forum.kirupa.com/t/help-with-fade-in-fade-out-at-timed-interval/177734/1 "2006-02-04T18:22:09Z")

</div>

I recently created a site ( [http://grove.ufl.edu/~ufpad](http://grove.ufl.edu/~ufpad) ), & I need help with the picture fade on that site.

Here is how the picture portion is set-up: I currently have a main movie with 2 targets (target1 & target2). I then load a random external movie into each target, have it stay on stage for a set amount of time, & then a new random movie is loaded in. This cycle repeats forever. Right now, I just fade-in the picture from the external movie’s own timeline using a transition. But the problem is there is no way to fade-out the movie before a new movie is loaded into it’s place.

Below is the actionscript I use to load the random movies & control their timed intervals (note: the arrays actually have 50 movies, but I reduced it to 4 for simplicity’s sake):

```auto
function swpt1() {
 target1.loadMovie(t1[random(t1.length)]);
}
function swpt2() {
 target2.loadMovie(t2[random(t2.length)]);
}
var t1:Array = new Array();
// target one's movies
t1[0] = "movie1.swf";
t1[1] = "movie2.swf";
t1[2] = "movie3.swf";
t1[3] = "movie4.swf";
var t2:Array = new Array();
// target 2's movies
t2[0] = "movie1.swf";
t2[1] = "movie2.swf";
t2[2] = "movie3.swf";
t2[3] = "movie4.swf";
// target1's interval is 18 seconds and target2's interval is 26 seconds
var targ1sInt = setInterval(swpt1, 18000);
var targ2sInt = setInterval(swpt2, 26000);
swpt1();
swpt2();

```

What would I add to, or change, in this actionscript to fade-in the movies into each target, and then once their interval ends, have them fade-out before loading the next random movie? If you could, please re-paste this actionscript with the changes in it… I’m not very good when it comes to actionscript 🙂
