# Finding the totalFrames of external swf

**URL:** <https://forum.kirupa.com/t/finding-the-totalframes-of-external-swf/313665>\
**Category:** flash\
**Created:** [September 6, 2010, 5:42pm UTC](https://forum.kirupa.com/t/finding-the-totalframes-of-external-swf/313665 "2010-09-06T17:42:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anand\_b\_v](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@anand\_b\_v](https://forum.kirupa.com/u/anand_b_v)\
**Post date:** [September 6, 2010, 5:42pm UTC](https://forum.kirupa.com/t/finding-the-totalframes-of-external-swf/313665/1 "2010-09-06T17:42:32Z")

</div>

Hi,

I am working on one project where I am externally loading an swf into a movie clip which doesn’t have a control on the file. But here I need to find when the swf file will end. So that I can trigger a js function at the end.

Here is the code…

function readyOnload() {  
ExternalInterface.call(“sendToJavaScript”,“Ready”);  
}

var swfLoader:Loader = new Loader();  
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadingCompleteListener, false, 0, true);  
var sound:Sound=new Sound();  
var soundChannel:SoundChannel = new SoundChannel();//=sound.play();

function loadSwf(url:String){  
var bgURL:URLRequest = new URLRequest(url);  
swfLoader.load(bgURL);  
load\_swf.addChild(swfLoader);  
}

function loadingCompleteListener(e:Event):void {  
trace(load\_swf.content);  
}

function initVideoPlayer():void {  
// hide buttons  
mcVideoControls.btnUnmute.visible= false;  
// add event listeners to all buttons  
mcVideoControls.btnMute.addEventListener(MouseEvent.CLICK, muteClicked);  
mcVideoControls.btnUnmute.addEventListener(MouseEvent.CLICK, unmuteClicked);  
//load\_swf.addEventListener(Event.ENTER\_FRAME, checkFunction);  
ExternalInterface.addCallback(“playSwf”,playSWF);

}

function playSWF(url:String){  
loadSwf(url);  
}

function muteClicked(e:MouseEvent):void {  
var t:SoundTransform = new SoundTransform();  
t.volume = 0;  
load\_swf.soundTransform = t;  
mcVideoControls.btnMute.visible= false;  
mcVideoControls.btnUnmute.visible= true;  
}

function unmuteClicked(e:MouseEvent):void {  
var t:SoundTransform = new SoundTransform();  
t.volume = .5;  
load\_swf.soundTransform = t;  
mcVideoControls.btnMute.visible= true;  
mcVideoControls.btnUnmute.visible= false;  
}

initVideoPlayer();  
readyOnload();

Please help me in this issue. Thanks in advance.
