Ok so I cannot figure out for the life of me how to accomplish this.

I have my main SWF. It contains buttons. I am using the Proloader script from the snippets to load
an external swf.

This external SWF is a seperate window that pops up on top of everything in my main swf. The external swf itself has a button and I need that button to close itself, so that you can essentially load the external swf from the main page, and hit a little X button in the corner of that external SWF to close it.


THIS works for the external swf by itself.

Close_But.addEventListener (MouseEvent.CLICK, fl_unloadwin);

function fl_unloadwin (event:MouseEvent):void {

this.stop();
this.parent.removeChild(this);
}


but it apparently doesnt work with the proloader script i used in the main SWF

Start_Button.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF);

import fl.display.ProLoader;
var fl_ProLoader:ProLoader;

//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad:Boolean = true;

function fl_ClickToLoadUnloadSWF(event:MouseEvent):void
{
if(fl_ToLoad)
{
fl_ProLoader = new ProLoader();
fl_ProLoader.load(new URLRequest("NW_BG.swf"));
addChild(fl_ProLoader);
fl_ProLoader.x = 75;
fl_ProLoader.y = 75;
}
else
{
fl_ProLoader.unload();
removeChild(fl_ProLoader);
fl_ProLoader = null;
}
// Toggle whether you want to load or unload the SWF
fl_ToLoad = !fl_ToLoad;
}


I need to get this working in any way possible. This is for a class project and my teacher sucks so bad he is essentially useless. If someone could fix this for me, I would be so grateful.

Thanks in advance.