I’m using this code to unload a swf file and go back to the main menu.
The main menu loads the external swf files with no trouble but for some reason unloading just doesn’t work.
var BaseMovie:MovieClip = parent.parent as MovieClip;
FinishButton.addEventListener(MouseEvent.MOUSE_UP, RemoveGame );
function RemoveGame(i:MouseEvent):void
{
BaseMovie.loader.unload(); //Loads previous movie and unloads current movie.
}
If you’re using
BaseMoviesomewhere else (and you are, because you’ve added it to the display list to make it visible), it won’t be destroyed as a result of callingLoader.unload().To remove
BaseMoviefrom the display list, do something like the following:Note that by convention, variable names start with lowercase. So instead of
BaseMovie, usebaseMovie.Hope this helps, good luck.