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.