1
votes

I have three movies: 1) main movie 2) external #1 3) external #2

When the main movie is opened it loads into new container "MovieClip" one of the external swf (depends on variable). in the main movie I have also a button that switch the external SWF to another. Each external have some sounds located on their keyframes. When I want to change the external with the "button" in main movie it loaded new external correctly but the old one is still below the new one and the old one still plays their sounds. How can I delete the previous SWF when I loading new one. remove or clear or mute the sounds of this external? Below is the code I'm creating all.

var ladujFilm:String = "external#x.swf"; // the name comes with amfPHP so it's dynamic

    var movieLoad:URLRequest = new URLRequest(ladujFilm);
    movieLoader.load(movieLoad);
    movieLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, movieLoaded_fn);

function movieLoaded_fn(event:Event):void {
    addChildAt(movieLoader, 1);
    movieLoader.x = 0;
    movieLoader.y = 0;
}
1

1 Answers

0
votes

the Loader class has the unloadAndStop method, you need to use it on the "old" loader.

docs

example

best regards