# Detecting end of loaded external swf

**URL:** <https://forum.kirupa.com/t/detecting-end-of-loaded-external-swf/301629>\
**Category:** flash\
**Created:** [December 12, 2009, 5:27pm UTC](https://forum.kirupa.com/t/detecting-end-of-loaded-external-swf/301629 "2009-12-12T17:27:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lesterp99](https://avatars.discourse-cdn.com/v4/letter/l/6a8cbe/32.png) [@lesterp99](https://forum.kirupa.com/u/lesterp99)\
**Post date:** [December 12, 2009, 5:27pm UTC](https://forum.kirupa.com/t/detecting-end-of-loaded-external-swf/301629/1 "2009-12-12T17:27:53Z")

</div>

Hi,  
I have a main swf file that needs to stop, load & play an external swf file the main timeline, & then resume the main timeline when the external swf has finished playing.

So I have the follwing code in a frame in the main timeline:

stop();  
var swf:MovieClip;  
var loader:Loader=new Loader();  
var defaultSWF:URLRequest = new URLRequest(“url/.swf”);

loader.load(defaultSWF);  
loader.x = 172;  
loader.y = 180;  
addChild(loader);

//////

function swfComplete(e:Event):void {  
// trace (“I’m here”);  
removeChild(loader);  
play();  
}

This loads and plays OK but it’s the unload and play that I’m struggling with.

What code can I use to detect the end of the external swf and either call swfComplete of goto a main timeline label?

Many thnx in anticipation,

Lesterp99  
Flash CS4  
AS3
