Interactive CD - Load and unload problems

I know this is probably a basic error I am making but I am really lost!

Please help if you can!

I am creating an interactive CD but the same files will be used online.

I have a menu that loads in a swf to sit on top of everything. In this movie I have a quit button. When I click this I want to close this top swf and reveal the swf beneath again.

I have managed to get the “quit button” to load in the menu swf again but it seems to me that it is loading in a second version of this as opposed to taking away the loaded movie.

The code I have used for this is:


quit_mc.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_2);

var fl_Loader_2:Loader;

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

function fl_ClickToLoadUnloadSWF_2(event:MouseEvent):void
{
if(fl_ToLoad_2)
{
fl_Loader_2 = new Loader();
fl_Loader_2.load(new URLRequest(“fscommand/early.swf”));
addChild(fl_Loader_2);
SoundMixer.stopAll();

}
else
{
    fl_Loader_2.unload();
    removeChild(fl_Loader_2);
    fl_Loader_2 = null;
    SoundMixer.stopAll();
    
}
// Toggle whether you want to load or unload the SWF
fl_ToLoad_2 = !fl_ToLoad_2;

}

I know this is not right but I can’t figure out how to do it properly.

What I am really trying to do is replace each movie with the loaded movie.

For example Movie 1 - has a menu in it. Clicking on Movie 2 menu option removes Movie 1 and replaces it with Movie 2.

Clicking on the “Quit” button in movie 2 would remove movie 2 and replace it with movie 1 again.

Any help is greatly appreciated!

Stevie