# How to remove audio in the background

**URL:** https://forum.kirupa.com/t/how-to-remove-audio-in-the-background/290437
**Category:** Uncategorized
**Created:** [June 14, 2009, 11:09pm UTC](https://forum.kirupa.com/t/how-to-remove-audio-in-the-background/290437 "2009-06-14T23:09:11Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![drakkonblade](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@drakkonblade](https://forum.kirupa.com/u/drakkonblade)
#### Post date: [June 14, 2009, 11:09pm UTC](https://forum.kirupa.com/t/how-to-remove-audio-in-the-background/290437/1 "2009-06-14T23:09:11Z")

</div>

i am trying to remove my sound from background…

for some reason keep getting this error

Error: Error #2029: This URLStream object does not have a stream opened.  
at flash.media::Sound/close()  
at Soundbox/killAudio()  
at Buttons/onClick()

i hope this doesnt become too much so bear with me please…  
this is my document class…

Quote:  
package  
{  
import flash.display.MovieClip;  
import Buttons;

public class Dominara extends MovieClip  
{  
public var s:Soundbox = new Soundbox(); //this calls onto your sound class which loads the sorrow music  
public function Dominara()  
{  
var btnClass:Buttons = new Buttons(exit\_btn,credits\_btn,options\_btn,continue\_ btn,newgame\_btn);  
s.playMain();  
}  
}  
}  
**now this is my sound class where i call upon to load the music…**

Quote:  
package  
{  
import flash.media.Sound;  
import flash.media.SoundLoaderContext;  
import flash.net.URLRequest;

public class Soundbox extends Sound  
{  
private var playsound:Sound = new Sound();  
private var loadmusic:URLRequest = new URLRequest(“sorrow.mp3”);  
private var context:SoundLoaderContext = new SoundLoaderContext(8000, true);

public function Soundbox()  
{  
trace(“working”);  
}

public function playMain()  
{  
playsound.load(loadmusic, context);  
playsound.play(0,20); //this will repeat the soundtrack x amount of times  
}

public function killAudio()  
{  
playsound.close();  
}  
}  
}  
**as can see i added or thought it would help the killaudio function …**

**now finally i want to be able to press this button and in it as its pressed it closes or removes the audio…**  
Quote:  
public function onClick(event:MouseEvent):void  
{  
ruut.gotoAndStop(4);  
ruut.s.killAudio();  
}  
_ **what should i place in my function to close the audio or kill it…** _
