I have a presentation that has 3 chapters. I’ve built functionality so that you can load each individual SWF chapter with a loader called singleLoader. I’ve also built in functionality so that at any time, you can hit the down arrow and it will unload those movies.
I have a separate button that allows you to loop through all 3 chapters. They’ll just play one after the other. The problem with this approach is that there are 2 different loaders and if I unload one of the chapters and try to start the looping, I can hear the audio, but I can’t see the movie.
Here’s the first loader:
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 works even on first call */
// Gets the next MC, waiting for INITialization before adding it to the stage
function nextClip():void {
thisLoader.load( new URLRequest(clips[index]) );
}
And here’s the kill function:
stage.addEventListener(KeyboardEvent.KEY_DOWN, quit);
function quit(e:KeyboardEvent):void{
if (e.keyCode == Keyboard.DOWN){
thisMC.gotoAndStop(1);
stage.removeChild(thisMC);
thisLoader.unloadAndStop();
singleLoader.unloadAndStop();
singleLoader.contentLoaderInfo.removeEventListener(Event.INIT, loadComplete);
thisLoader.contentLoaderInfo.removeEventListener(Event.INIT, doneLoading);
}
}
unloadAndStop() is supposed to remove everything, but it doesn’t. Any suggestions?