# Interacting with external SWF

**URL:** <https://forum.kirupa.com/t/interacting-with-external-swf/260402>\
**Category:** flash\
**Created:** [May 15, 2008, 10:33am UTC](https://forum.kirupa.com/t/interacting-with-external-swf/260402 "2008-05-15T10:33:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lugh000](https://avatars.discourse-cdn.com/v4/letter/l/76d3ee/32.png) [@lugh000](https://forum.kirupa.com/u/lugh000)\
**Post date:** [May 15, 2008, 10:33am UTC](https://forum.kirupa.com/t/interacting-with-external-swf/260402/1 "2008-05-15T10:33:18Z")

</div>

Hello all! 😑

I have did a search before posting this, but could not find a simple answer to my problem.

I have developed a “player” shell SWF file. It is only 1 frame long and has AS3 script inside. The purpose of this “shell” is to:

[LIST]  
[_]get a string from my ASP page via flashvars [COLOR=DarkGreen]**(NO PROBLEM)**[/COLOR]  
[_]read an external SWF file with the filename = string passed in [COLOR=DarkGreen]**(NO PROBLEM)**[/COLOR]  
[_]place it on the stage OR inside a newly created MovieClip and then place that on stage [COLOR=DarkGreen]**(NO PROBLEM)**[/COLOR]  
[_]trying to figure out when the imported SWF finished playing [COLOR=Red]**(PROBLEM)**[/COLOR]  
[\*]trigger an external JavaScript based on that event **(NOT YET IMPLEMENTED)**  
[/LIST]  
The external SWF is a simple file that has some animations on its timeline and a stop() command on its last frame.

[COLOR=Red]\*\*QUESTION: How do I access the properties of the imported SWF, like the number of frames? :stare:

Thank you in advance! 😑  
\*\*[/COLOR]  
Here is the code I have so far:

[FONT=Courier New][COLOR=Navy]import flash.display._;  
import flash.events._;  
import flash.net.URLRequest;  
import flash.text.\*;

var f:String = “ball.swf”;  
var loader:Loader = new Loader();  
var swfContainer= new MovieClip();  
swfContainer.name = “swfContainer”;

function preloader()  
{  
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);  
var request:URLRequest = new URLRequest(f);  
loader.load(request);  
addChild(swfContainer);  
}

function completeHandler(event:Event):void  
{  
var loaderInfo:LoaderInfo = event.target as LoaderInfo;  
addChild(event.target.content);  
var swf:Object = loaderInfo.content;

```
swfContainer.addChild(loader)
swfContainer.addEventListener(Event.ENTER_FRAME, containerHandler);

```

}

function containerHandler(event:Event):void  
{  
// something will happen here  
// check if the currentFrame = totalFrames  
// not yet implemented  
}  
// start the show  
preloader();[/COLOR][/FONT]
