Trying to call a root level function from within a loaded swf
I'm not very familiar with AS3... I'm trying to have a loaded swf file call a function from the parent to unload itself when it comes to the end (on the timeline, not as a button). I'm assuming I need to be calling the function (that is used for the close button) from the loaded swf (perhaps I'm mistaken though?).
Here's the code from one of my buttons that loads an swf. I'm guessing I need to call the closeSWF function from the timeline of my loaded movie but having no luck figuring out how to do that.
Any help would be appreciated.
// 01 ------------------------------------------------------
function loadWeaving(ev:MouseEvent):void {
// load SWF
var movieClip:MovieClip = new holder_mc;
//add it to the stage
addChild(holderSWF);
holderSWF.x=0;
holderSWF.y=0;
//
var requestEN:URLRequest = new URLRequest("WhatIsWeaving_Eng.swf"); // english
holderSWF.load(requestEN);
//
close_bt.addEventListener(MouseEvent.CLICK, closeSWF);
function closeSWF(infoObject:Object):void {
trace("close SWF");
removeChild(holderSWF);
// reset switch
close_bt.visible = false;
showAllButtons();
infoObject.currentTarget.removeEventListener(infoObject.type, closeSWF);
}
//
setChildIndex(close_bt,numChildren - 1);
close_bt.visible = true;
hideAllButtons();
// - start timer last
myTimer.addEventListener(TimerEvent.TIMER, closeSWF);
}
