Sound volume

Hello, i got this code that should load a sound and slowly raise the volume for that sound. However, instead of just affecting one sound, it affects all the sounds in my movie, causing all of them to be low at first.

var bgSound, bgSoundvol;
bgSound = new sound();
bgSound.attachSound(“bgsound1”);
bgSound.start(0, 1000);
bgSound.setVolume(0);
this.onEnterFrame = function() {
if (bgSoundvol>=100) {
this.onEnterFrame = null;
}
bgSoundvol = bgsoundvol+5;
bgSound.setVolume(bgSoundvol);
};

Can anyone see why this side effect occurs?

Any help is appreciated… thank you.

var bgSound, bgSoundvol;
bgSound = new Sound();
bgSound.attachSound("bgsound1");
bgSound.start(0, 1000);
bgSound.setVolume(0);
onEnterFrame = function() {
   bgSoundvol < 100 ? bgSoundvol += 5 : null
   bgSound.setVolume(bgSoundvol);
};

You need to asign the sound to its own move clip

[AS]bgSound = new Sound(bgSoundMc);[/AS]

Any sound that insn’t defined in its own move clip when u affect it it will affect all the other sounds that are also not in there own movie clip.

Does that mean that all I have to is change the code to:

ActionScript:

bgSound = new Sound(bgSoundMc);

and add a mc named bgsoundmc for this problem to be solved?

it shouldn’t jsut add what i did in the brackets and test it. I’m sure it will localize the changes to jsut that sound. I believe u dont’ even have to create the MC on the stage. jsut add that ot your code. IF stilla problem then Create a MC with that instance name on the stage.

Thank you, your suggestions worked. To make it work all I needed to do was add your line of code, and make a mc with the corressponding instance name.

Your welcome.