# Sound Object - specifying only certain sound to stop

**URL:** <https://forum.kirupa.com/t/sound-object-specifying-only-certain-sound-to-stop/169262>\
**Category:** flash\
**Created:** [November 14, 2005, 9:00pm UTC](https://forum.kirupa.com/t/sound-object-specifying-only-certain-sound-to-stop/169262 "2005-11-14T21:00:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![boua5828](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@boua5828](https://forum.kirupa.com/u/boua5828)\
**Post date:** [November 14, 2005, 9:00pm UTC](https://forum.kirupa.com/t/sound-object-specifying-only-certain-sound-to-stop/169262/1 "2005-11-14T21:00:15Z")

</div>

Hi everyone. I’ll try to make this as brief as possible. I am creating a flash project which contains video on a few pages. The project also contains background music which loops contiuously.

The goal is to have the background music stop whenever the user is on a page containing video and for the music to play again when the user leaves said page.

The script I created works to stop the music, but it also stops the audio contained within the video and causes the video player (by proxxus) to lock up.

The solution is probably a simple one, but I’m having difficulty figuring it out.  
If anybody can see where I’ve gone wrong, your help would be greatly appreciated. Here’s the setup:

**Library:**  
music.wav - linkage = “myMusic01”

**Main Timeline:**

```auto
//-- create a variable to determine if the current movie contains video
var currMovie:String = "notVideo";
//-- start playing sound object
myMusicMc.myMusic.start(0, 999);

```

**myMusicMc** (residing on main timeline)  
_frame 1_

```auto
//-- set up sound object
myMusic=new Sound(); 
myMusic.attachSound("myMusic01");

```

_frame 2_

```auto
//-- check the variable "currMovie"
if (_root.currMovie == "Video") {
	_root.myMusicMc.myMusic.stop();
} else {
	_root.myMusicMc.myMusic.play();
}

```

_frame 3_

```auto
//-- create a loop to continuously check the variable
gotoAndPlay(2);

```

**on the actions layer of the movie clip containing my navigation controls**  
_snippet of the callback used_

```auto
videoLink_mc.onRelease = function() {
	_parent.prodDetail_mc.gotoAndPlay("video");
	_root.currMovie="Video";
}

```

on all the other buttons currMovie is set to “notVideo”
