Multiple sound objects manipulation

i have a problem manipulating multiple sound objects in MX. i have a main background loop object and a button rollover object (which plays on specific buttons). i then have a volume slider which will set the volume of **only **the main bg loop object. but when i tested it, it seems that the volume of the button rollover object is also the same with the main bg loop object’s volume. meaning, if my main bg loop’s volume is down to 50, the button rollover sound volume is also 50.

here’re my codes:

//code on 1st frame
mainLoop = new Sound();
mainLoop.attachSound(“mainLoop”);
mainLoop.start();
mainLoop.onSoundComplete = function(){
mainLoop.start();
}

hoverSound = new Sound();
hoverSound.attachSound(“hoverSound”);

//code on slider MC
onClipEvent(enterFrame){
if(drag){
_root.mainLoop.setVolume(this._x); //this._x is between 0-100
}
}

//code on sample button
on(rollOver){
hoverSound.start();
}

thanks!

It’s because you didn’t give a target to the sound object. If you do that, then the sound object will be like, a global sound object that controls every sound in your movie. So make sure to create your sound object with a target, and it should be fixed.

[variable] = new Sound([target]);

I’m not sure if two Sound objects can have the same target, but try this:
mainLoop = new Sound(this); and hoverSound = new Sound(this);

If it’s still not fixed, use different targets, like one sound object targets this and the other targets this._parent or something. Or create two empty movieclips and use them as a target, whatever you feel like doing.

thanks! come to think of it, i already “half-fixed” it when i targeted the hoverSound loop to a container MC. I should’ve done it with the mainLoop too. now they work like a charm. thanks again. :slight_smile:

here’s my new code (with container MC’s outside the stage):

mainLoop = new Sound(mainLoopMC);
mainLoop.attachSound(“mainLoop”);

hoverSound = new Sound(hoverSoundMC);
hoverSound.attachSound(“hoverSound”);

Anytime :slight_smile: