# Audio actionscript problem

**URL:** <https://forum.kirupa.com/t/audio-actionscript-problem/288069>\
**Category:** flash\
**Created:** [May 10, 2009, 6:25pm UTC](https://forum.kirupa.com/t/audio-actionscript-problem/288069 "2009-05-10T18:25:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ransom1337](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@Ransom1337](https://forum.kirupa.com/u/Ransom1337)\
**Post date:** [May 10, 2009, 6:25pm UTC](https://forum.kirupa.com/t/audio-actionscript-problem/288069/1 "2009-05-10T18:25:31Z")

</div>

Hello,

I am using actionscript to play sounds in my game. Here is the code I’m using for a gun firing when the user clicks:

```auto
var beretta:Sound = new Sound();
beretta.attachSound("gunshot");
beretta.start(0, 0);

```

That works fine. I also have a background sound that plays on a constant loop:

```auto
var tvstaticsound:Sound = new Sound();
 tvstaticsound.attachSound("tvsound");
 tvstaticsound.start (0, 999);
 tvstaticsound.setVolume(5);

```

The above sound varies in volume depending on what room the player enters. I’m using the following code to alter the volume:

```auto
_root.tvstaticsound.setVolume(7);

```

The problem I’m having is that when the actionscript alters the volume of tvstaticsound, the beretta sound also gets changed to the same volume. What am I doing wrong? Surely only the audio I’ve specified should have its volume changed?

Thank you.
