# Load swf sequence with setInterval

**URL:** <https://forum.kirupa.com/t/load-swf-sequence-with-setinterval/181372>\
**Category:** Uncategorized\
**Created:** [March 8, 2006, 6:52pm UTC](https://forum.kirupa.com/t/load-swf-sequence-with-setinterval/181372 "2006-03-08T18:52:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![liquify](https://avatars.discourse-cdn.com/v4/letter/l/e95f7d/32.png) [@liquify](https://forum.kirupa.com/u/liquify)\
**Post date:** [March 8, 2006, 6:52pm UTC](https://forum.kirupa.com/t/load-swf-sequence-with-setinterval/181372/1 "2006-03-08T18:52:23Z")

</div>

Hi all,

I’m trying to do this for hours…

I want to load some external swfs in sequence - after the first swf finishes I want to wait x seconds before i load the new one. Thet also have a alpha transition. I can do it with buttons, but i cant get this to work automatically.

Here’s the code

```auto
 
// for alpha transitions 
MovieClip.prototype.fadeIn = function() {
	this.onEnterFrame = function() {
		if (this._alpha<100) {
			this._alpha += 10;
		} else {
			delete this.onEnterFrame;
		}
	};
};
bar._visible = false;

my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
	trace("started loading "+targetMC);
	_root.holder._alpha = 0;
	bar._visible = true;
	pText._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
	bar._width = (lBytes/tBytes)*100;
	pText.text = Math.round((lBytes/tBytes)*100)+ "%";
};
preload.onLoadComplete = function(targetMC) {
	_root.holder.fadeIn();
	bar._visible = false;
	pText._visible = false;
	trace(targetMC+" finished");
};

var i = 0;
var totalswfs = 2;
 
function loadFrame() {
        my_mc.loadClip(i+".swf", _root.holder); // load swf 
       
}

loadFrame(); // loads the first swf (0.swf)

```

this is the part that is working… now my problem is to load the next movies with the delay…

i tried

```auto

sequence = function () {
	if (i<Number(totalswfs)-1) {
   	i++;
   	my_mc.loadClip(i add ".swf");
    clearInterval(delay);
	
	 }
};
 
delay = setInterval(this,"sequence", 5000);

sequence();

```

but obviously it’s wrong…

can you please help me?

[here’s the fla](http://www.soromenho.net/movies.zip)

thank you so much
