# Looping through swf files

**URL:** <https://forum.kirupa.com/t/looping-through-swf-files/295342>\
**Category:** Uncategorized\
**Created:** [August 28, 2009, 12:55pm UTC](https://forum.kirupa.com/t/looping-through-swf-files/295342 "2009-08-28T12:55:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Donnii](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@Donnii](https://forum.kirupa.com/u/Donnii)\
**Post date:** [August 28, 2009, 12:55pm UTC](https://forum.kirupa.com/t/looping-through-swf-files/295342/1 "2009-08-28T12:55:39Z")

</div>

Hi guys,

I’m somehow a newbie with AS and flash so i need to a script that loops through, let say 1-\* swf files here what i did and i’m probably missing something OR i’m just not right at all

var my\_array:Array = my\_str.split(",");  
var loader:Loader = new Loader();  
var mc:MovieClip;

function callback (){

```
var swf:URLRequest = new URLRequest(my_array*);

loader.load(swf);

addChild(loader);
    
loader.contentLoaderInfo.addEventListener("complete",movieComplete);

i++;
if( i == my_array.length){ //chk if it's the end of my swf array put it back to 0
    i =0;
}

```

}

function movieComplete(event:Event):void {  
mc = new MovieClip();

```
 mc.addChild(loader);

 addChild(mc);

  mc.addEventListener(Event.ENTER_FRAME, checkIsLast);

```

}

function checkIsLast(e:Event):void{  
//trace(mc.currentFrame +":"+ mc.totalFrames);  
//trace(mc);

```
if(mc.currentFrame == mc.totalFrames){ //changed this
    trace("done");
 }

```

}

callback();

pleaaaase help me, i need this for my project 🙂

thx
