Simple sound questions

I have on my main timeline


muz = new Sound();
muz.attachSound("music");
muz.start(0,999);
winz = new Sound();
winz.attachSound("wind");
winz.start(0,999);

So it’s starting two different sound loops

then on my stop music button I have


on (release) {
	_parent.muz.stop();
	gotoAndPlay("mon");
}

This all works fine except when i click on the button it turns off BOTH sound instead of the one i’m targeting

anyone know why?

Sandman9

The Sound object lets you control sound in a movie. You can add sounds to a movie clip from the Library while the movie is playing and control those sounds. If you do not specify a target when you create a new Sound object, you can use the methods to control sound for the whole movie. You must use the constructor new Sound to create an instance of the Sound object before calling the methods of the Sound object.

http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary654.html

ohhhh they are both targeting “new sound();” … that’s a rather poor mistake on my part …

So to fix the problem I don’t suppose I could replace new sound(); with say a variable b/c it’s declaring a new sound … ummm … so how can i differentiate the two then?

Sandman9

To fix the problem, you must give the sounds targets. Controlling any Sound instance that has been created without a target will control every sound in the entire movie, as stated in the quote above.

It comes down to changing


muz = new Sound(this);

Where this is the target of the Sound instance. I don’t know if you can use the same target twice - try it out. If not, create an empty movieclip and use that as a target.

To fix the problem, you must give the sounds targets. Controlling any Sound instance that has been created without a target will control every sound in the entire movie, as stated in the quote above.

It comes down to changing


muz = new Sound();

to


muz = new Sound(this);

Where this is the target of the Sound instance. I don’t know if you can use the same target twice - try it out. If not, create an empty movieclip and use that as a target.

you have come to the rescue again :smiley:

I gave the MC’s that the stop buttons were in instance names … then I just changed it to like you said



muz = new Sound(instance_name);

Thanks again
Sandman9

No problem :wink: