# Load swf with time delay

**URL:** https://forum.kirupa.com/t/load-swf-with-time-delay/291951
**Category:** Uncategorized
**Created:** [July 8, 2009, 8:15am UTC](https://forum.kirupa.com/t/load-swf-with-time-delay/291951 "2009-07-08T08:15:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![vandriver](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@vandriver](https://forum.kirupa.com/u/vandriver)
#### Post date: [July 8, 2009, 8:15am UTC](https://forum.kirupa.com/t/load-swf-with-time-delay/291951/1 "2009-07-08T08:15:21Z")

</div>

I am loading/unloading various swf animation which is now working fine.

But I can work how to make a delay for 8 secs before the next swf loads.

This is the code which i have been using.

var clips:Array = [“clip0.swf”, “clip1.swf”, “clip2.swf”];  
var index:int = 0;

var thisLoader:Loader = new Loader();  
thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);  
var thisMC:MovieClip = new MovieClip();  
stage.addChild(thisMC);  
function nextClip():void {  
thisLoader.load( new URLRequest(clips[index]) );  
}

function doneLoading(e:Event):void {  
stage.removeChild(thisMC);  
thisMC = MovieClip(thisLoader.content);  
thisLoader.unload();  
thisMC.addEventListener(Event.ENTER\_FRAME, runOnce);  
stage.addChild(thisMC);  
thisMC.gotoAndPlay(1);  
}

function runOnce(e:Event):void {  
if (thisMC.currentFrame == thisMC.totalFrames) {  
thisMC.removeEventListener(Event.ENTER\_FRAME, runOnce);  
index = (index + 1)%(clips.length);  
nextClip();  
}  
}

nextClip();

please could some help.

:diss:
