I've got a Flash piece with multiple sounds which I'm using as sound objects.
I've defining the sound objects like this:
rollover = new Sound ();
rollover.attachSound ("rollover.aif");
buttonsIn = new Sound ();
buttonsIn.attachSound ("buttons_in.aif");
Then, from other timelines, I'm triggering the sound like this:
_parent.rollover.setVolume (100);
_parent.rollover.start (0, 1);
Triggering the sound works fine. However, when I set the volume for a single
sound object (in this case, "rollover"), it sets that same volume for every
sound object. For example, I can set the volume for "buttonsIn" as 35. Then
later, I can set the volume for "rollover" as 100. However, when I do that, the
volume for "buttonsIn" also gets set to 100.
Gustavo De Tanti - 30 Sep 2005 20:43 GMT
If you create the sound object in that way you'll only obtain a single
global sound. You need create mc to hold the sounds:
ro=this.createEmptyMovieClip("romc",99998);
bi=this.createEmptyMovieClip("bimc",99999);
rollover = new Sound (ro);
rollover.attachSound ("rollover.aif");
buttonsIn = new Sound (bi);
buttonsIn.attachSound ("buttons_in.aif");
then:
_parent.rollover.setVolume (100);
_parent.rollover.start (0, 1);
> I've got a Flash piece with multiple sounds which I'm using as sound
> objects.
[quoted text clipped - 20 lines]
> that, the
> volume for "buttonsIn" also gets set to 100.
paulpsd7 - 30 Sep 2005 21:09 GMT
Okay, I got an answer.
To set the volume independently for different sound objects, I needed to
associate each sound object with a movie clip. This is the code that worked.
tthis.createEmptyMovieClip("buttonsIn_mc", 0);
buttonsIn = new Sound (buttonsIn_mc);
buttonsIn.attachSound ("buttons_in");
this.createEmptyMovieClip("rollover_mc", 1);
rollover = new Sound (rollover_mc);
rollover.attachSound ("rollover.aif");
this.createEmptyMovieClip("transition1_mc", 2);
transition1 = new Sound (transition1_mc);
transition1.attachSound ("event33.aif");
this.createEmptyMovieClip("ponghit_mc", 3);
ponghit = new Sound (ponghit_mc);
ponghit.attachSound ("pong_hit.aif");
this.createEmptyMovieClip("transition2_mc", 4);
transition2 = new Sound (transition2_mc);
transition2.attachSound ("transition2.aif");