Loading in and external swf and unloading it from a MC button inside the external swf
Hi,
I used to do this fine with AS2 and now i'm struggling to get it to work in AS3.
my code is as follows:
PW1.addEventListener( MouseEvent.CLICK,loader1 );
//==================== PS function =============================================
var ldr:Loader = new Loader();
function loader1 (evt:MouseEvent) {
ldr.load(new URLRequest("projectSheet.swf"));
ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, loaded);
}
var thisMovieClip:MovieClip;
function loaded (evt:Event) :void {
stage.addChild(ldr);
thisMovieClip = MovieClip(ldr.content);
}
function unloader (evt:MouseEvent) :void {
stage.removeChild(ldr);
}
on the main stage frame 1
then on the external swf frame 1:
//unload_mc.buttonMode = true;
//unload_mc.addEventListener( MouseEvent.CLICK, unloader );
unload_mc is a movieClip that I want to use to unload it's self. The function unloader is in frame 1 of the main stage.
I also have code making movieClips come to the front when rolled over:
this.addEventListener(MouseEvent.MOUSE_OVER, onBringToTop, false, 0, true);
function onBringToTop(evt:MouseEvent):void {
setChildIndex(MovieClip(evt.target), numChildren-1);
}
also on the main timeline.
please help:confused: