# \[Kirupa Tut\] Fading Grid with setInterval

**URL:** <https://forum.kirupa.com/t/kirupa-tut-fading-grid-with-setinterval/177394>\
**Category:** flash\
**Created:** [February 1, 2006, 4:24pm UTC](https://forum.kirupa.com/t/kirupa-tut-fading-grid-with-setinterval/177394 "2006-02-01T16:24:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Supadiri](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Supadiri](https://forum.kirupa.com/u/Supadiri)\
**Post date:** [February 1, 2006, 4:24pm UTC](https://forum.kirupa.com/t/kirupa-tut-fading-grid-with-setinterval/177394/1 "2006-02-01T16:24:37Z")

</div>

Hi everyone 🙂

I’ve made an interval that switch 3 photos i have in 3 different layers, changing their depth with the swapDepths method.

here’s the code :

```auto

// SETTO L'INTERVAL

stop();
var intervalId;
var count = 1;
var profonfita = 1;
var maxCount= 3;
var duration= 5000;

function Intervallo() {
 trace("Intervallo intervalId: " + intervalId + " count: " + count);
  this["foto_mc"+count].swapDepths(profondita)
 if(count == maxCount) {
	count=0;
 } 
 count++;
 profondita++;
}

intervalId = setInterval(this, "Intervallo", duration);

```

Everything works well so i’ve tried to improve this with the Fading Grid tutorial that i’ve found here in Kirupa :

[http://www.kirupa.com/developer/mx/fadegrid.htm](http://www.kirupa.com/developer/mx/fadegrid.htm)

I’d like to have the fading grid effect everytime that one of my pic swaps to the layer above. (so an automated fotogallery with that effect everytime a photo comes on the stage).

I’ve tried to put this function :

```auto

fadeOut(0, 5);

```

inside my interval, but it works once, only on the 1st photo.

Does anyone knows how to implement this?

Thx a lot guys, Kirupa rocks!
