# Automatically loading external swfs

**URL:** <https://forum.kirupa.com/t/automatically-loading-external-swfs/307166>\
**Category:** flash\
**Created:** [March 30, 2010, 1:40am UTC](https://forum.kirupa.com/t/automatically-loading-external-swfs/307166 "2010-03-30T01:40:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wdense51](https://avatars.discourse-cdn.com/v4/letter/w/45deac/32.png) [@wdense51](https://forum.kirupa.com/u/wdense51)\
**Post date:** [March 30, 2010, 1:40am UTC](https://forum.kirupa.com/t/automatically-loading-external-swfs/307166/1 "2010-03-30T01:40:58Z")

</div>

Hi

I’m really new to AS3 and have been playing around with tutorials and learning about external swf files…

Currently, I’ve got one external swf loaded that plays looped and have a button that loads the second swf (which has flv content).

I’m wondering how to get the first swf to reload automatically and play looped again when the second swf finishes playing.

I’ve beentrying this for quite a few days now and don’t seem to get any closer.

The code I’m using is:

var Xpos:Number=110;  
var Ypos:Number=110;  
var swf\_MC:MovieClip = new MovieClip();  
var loader:Loader = new Loader();

var defaultSWF:URLRequest = new URLRequest(“arch\_reel.swf”);

addChild (swf\_MC);  
swf\_MC.x=Xpos  
swf\_MC.y=Ypos

loader.load(defaultSWF);  
swf\_MC.addChild(loader);  
//Btns Universal Function  
function btnClick(event:MouseEvent):void{  
SoundMixer.stopAll();  
swf\_MC.removeChild(loader);

```
var newSWFRequest:URLRequest = new URLRequest(event.target.name + ".swf");
loader.load(newSWFRequest);
swf_MC.addChild(loader);

```

}

//Btn Listeners  
motion.addEventListener(MouseEvent.CLICK,btnClick);
