Ok guys, please help me! Here´s the thing, On frame 446 in the main timeline I have a button (btn_habitat) that when clicked it launches an external swf and moves the timeline to frame 461. Everything works fine. The swf loads and it shows on stage.
Now, on frame 461 there´s another button called btn_home2 and what I want is that when this button is clicked I want it to unload/remove the swf playing on stage.
I don´t know how to reference to the code inside the btn_habitat button. NOTE that the btn_home2 has no code within it as btn_habitat does.
I attach the code that is within the button (btn_habitat) and that loads the swf:
var thisLoader:Loader = new Loader();
thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
var thisMC:MovieClip = new MovieClip();
stage.addChild(thisMC); // Add empty MC initially so the nextClip function can be generic
// Removes old MC and gets the next one, waiting until when it has initialized beore adding it to the stage
function nextClip():void {
thisLoader.load(new URLRequest("habitat.swf"));
}
// Tell AS that the loaded file is a movie clip and add it to the stage.
function doneLoading(neve:Event):void {
stage.removeChild(thisMC);
thisMC = MovieClip(thisLoader.content);
thisLoader.unload();
stage.addChild(thisMC);
thisMC.play();
thisMC.x=5;
thisMC.y=-25;
}
// "Next button" just calls a function that goes to the next file name (mod the number of files in the list)
//btn_habitat.addEventListener(MouseEvent.CLICK, playNext);
function playNext(ev2:MouseEvent) {
MovieClip(parent).gotoAndPlay(447);
trace("hola");
nextClip();
this.removeEventListener(MouseEvent.CLICK, playNext);
}
Now I attach the code in frame 461:
stop();
btn_home2.addEventListener(MouseEvent.CLICK, mouseDownHandler7);
function mouseDownHandler7(ev:MouseEvent):void {
gotoAndPlay(461);
//WHAT DO I PUT HERE TO UNLOAD/REMOVE THE SWF?!?!?
this.removeEventListener(MouseEvent.CLICK, mouseDownHandler7);
}
Thanx in advance!