# Apply a Timer to

**URL:** <https://forum.kirupa.com/t/apply-a-timer-to/320417>\
**Category:** flash\
**Created:** [March 23, 2011, 4:32am UTC](https://forum.kirupa.com/t/apply-a-timer-to/320417 "2011-03-23T04:32:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diablo404](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Diablo404](https://forum.kirupa.com/u/Diablo404)\
**Post date:** [March 23, 2011, 4:32am UTC](https://forum.kirupa.com/t/apply-a-timer-to/320417/1 "2011-03-23T04:32:52Z")

</div>

Hello everyone!

For a student project, I need to make a little animation in Flash.

So I would like to make few Swf’s succeed. I found, as a start, this little piece of code in the Flashkit board. ( [http://board.flashkit.com/board/showthread.php?t=813752](http://board.flashkit.com/board/showthread.php?t=813752) )

```auto
var externalSWFs:Array = new Array(
	"swfs/ADVAllDemoFLASHv1.0.swf",
	"swfs/File2.swf",
	"swfs/File3.swf"
	// etc
);
var loadedSWFs:Array = new Array();

for (var i:int=0; i<externalSWFs.length; i++)
{
	// create a loader
	var imgLoader:Loader = new Loader();
	imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);

	// load the SWF
	var imgRequest:URLRequest = new URLRequest(externalSWFs*);
	imgLoader.load(imgRequest);

	// keep track of the SWF for later
	loadedSWFs.push(imgLoader);
	addChild(imgLoader);
}

var loaded:int = 0;
var currentAnimation:int = 0;
function loadComplete(event:Event):void
{
	// pause and hide the SWF
	event.target.loader.stop();
	event.target.loader.visible = false;

	if (++loaded == externalSWFs.length)
	{
		// all SWFs loaded
		// start the first animation
		loadedSWFs[currentAnimation].visible = true;
		loadedSWFs[currentAnimation].play();
		currentAnimation++;
	}
}

```

This code is ok to call many Swf’s, but not to place them at a special timing. I would like to have a Timing control on them, like:

Mc01.swf plays X sec, then stop. Then Mc02.swf plays X sec, then stop. Then Mc03.swf plays X sec, etc…

So! if anyone have any suggestions or hints to help me, I’ll be very gratefull.

Thanks in advance.

Diablo404
