# Problem with closing loader, sound keeps playing

**URL:** <https://forum.kirupa.com/t/problem-with-closing-loader-sound-keeps-playing/292527>\
**Category:** Uncategorized\
**Created:** [July 15, 2009, 11:20am UTC](https://forum.kirupa.com/t/problem-with-closing-loader-sound-keeps-playing/292527 "2009-07-15T11:20:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gordonski](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@Gordonski](https://forum.kirupa.com/u/Gordonski)\
**Post date:** [July 15, 2009, 11:20am UTC](https://forum.kirupa.com/t/problem-with-closing-loader-sound-keeps-playing/292527/1 "2009-07-15T11:20:43Z")

</div>

Hi there,

Since im still a beginner im running into this problem: I have a main movie wich loades video from external swf files through the loader. If i unload the loader and remove the child the sound keeps playing from the previous swf. Below my code and i know it aint pretty so any help would be very nice ! thx in advance ! :write:

```auto
this.stage.scaleMode = "noScale";

var clips:Array = ["scene01.swf", "scene02.swf", "scene03.swf", "scene04.swf", "scene05.swf", "scene06.swf"];
var index:int = 0;

var request:URLRequest = new URLRequest(clips[index]);
var loader:Loader = new Loader();

loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);

function loadProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
trace("Loading: "+percentLoaded+"%");
}

function loadComplete(event:Event):void {
trace("Complete");
}
 
loader.load(request);

function holderAdd(){
	//loader.close();
	loader.unload();
	holder.addChild(loader);
	}
	holderAdd();
	
function sceneOne():void {
	holderAdd();
	loader.load( new URLRequest(clips[0]) );
}
 
function sceneTwo():void {
	holderAdd();
	loader.load( new URLRequest(clips[1]) );
}

function sceneThree():void {
	holderAdd();
	loader.load( new URLRequest(clips[2]) );
}
 
function sceneFour():void {
	holderAdd();
	loader.load( new URLRequest(clips[3]) );
}

function sceneFive():void {
	holderAdd();
	loader.load( new URLRequest(clips[4]) );
}

function sceneSix():void {
	holderAdd();
	loader.load( new URLRequest(clips[5]) );
}

function speelScene01(evt:MouseEvent):void {
	holder.removeChild(loader);
	trace("loader removed");
	sceneOne();
	holder.navBar.btnDroomhuis.removeEventListener(MouseEvent.CLICK, speelScene01);
}

function speelScene02(evt:MouseEvent):void {
	holder.removeChild(loader);
	sceneTwo();
}

function speelScene03(evt:MouseEvent):void {
	holder.removeChild(loader);
	sceneThree();
}

function speelScene04(evt:MouseEvent):void {
	holder.removeChild(loader);
	sceneFour();
}

function speelScene05(evt:MouseEvent):void {
	holder.removeChild(loader);
	sceneFive();
}

function speelScene06(evt:MouseEvent):void {
	holder.removeChild(loader);
	sceneSix();
}

```
