# Loading several SWF files into a parent SWF file

**URL:** <https://forum.kirupa.com/t/loading-several-swf-files-into-a-parent-swf-file/302191>\
**Category:** flash\
**Created:** [December 23, 2009, 3:02am UTC](https://forum.kirupa.com/t/loading-several-swf-files-into-a-parent-swf-file/302191 "2009-12-23T03:02:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![felix3000](https://avatars.discourse-cdn.com/v4/letter/f/f07891/32.png) [@felix3000](https://forum.kirupa.com/u/felix3000)\
**Post date:** [December 23, 2009, 3:02am UTC](https://forum.kirupa.com/t/loading-several-swf-files-into-a-parent-swf-file/302191/1 "2009-12-23T03:02:39Z")

</div>

I have this working in AS2 but can not get it right in AS3.

Have scripts that load the files one after the other but they have to be the same length. Does anyone know how I can do the script below in AS3?

var swfs = [“reel1.swf”,“reel2.swf”,“reel6.swf”];  
var currentMovie = 0;

\_root.createEmptyMovieClip(“clip”,0);

\_root.clip.loadMovie(swfs[currentMovie]);  
\_root.onEnterFrame = checkLoadFinish;

function checkLoadFinish() {  
if ((\_root.clip.getBytesTotal() \> 4) && (\_root.clip.getBytesLoaded() \>= \_root.clip.getBytesTotal())) {  
delete \_root.onEnterFrame;  
\_root.clip.onEnterFrame = checkPlayFinished;  
}  
}

function checkPlayFinished() {  
if (this.\_currentframe == this.\_totalframes) {  
[//this.stop](https://this.stop)();  
currentMovie = (currentMovie+1)%swfs.length; //goes from 0 to 2 and back to 0  
\_root.clip.loadMovie(swfs[currentMovie]);  
delete this.onEnterFrame;  
\_root.onEnterFrame = checkLoadFinish;  
}  
}

Thanks!
