Hi and thanks for taking a look.
I have this problem which I hope to be able to solve as soon as possible.
I am trying to create a movie that introduce some musical instruments to people.
I have several sounds that I would need to control. I have a background music, which i used linkage as bgmusic, and some other instrument specific sound files.
The background music should be ON by default. THe user have the power to turn it on or off. The user should also be able to play the various instruments via play/stop buttons.
I declared 2 sound objects in the frame script.
//sound declaration
bkgrdmusic = new Sound();
instrument = new Sound();
//attach sound
bkgrdmusic.attachSound(“bgmusic”);
//start playing background music and set var to true
bkgrdmusic.start(0,999);
bkgrdmusicplaying=true;
//if user click on instance of On/Off button for background music
onoffButton.onRelease= function(){
if (bkgrdmusicplaying!=true){ //if background music is off
onoffButton.gotoAndPlay(1);//change frame of onoffButton clip
_root.bkgrdmusic.start(0,999);//start background music
bkgrdmusicplaying=true; //set to true
}
else{ //if background music is on
onoffButton.gotoAndPlay(2);
bkgrdmusic.stop(); //stop background music
bkgrdmusicplaying=false; //set to false
}
}
I have a play button and a stop button for the instrument
Scripting for the Play Button:
on (release){
//if background music is playing
if (_root.bkgrdmusicplaying!=false){
_root.bkgrdmusic.setVolume(5); //lower volume
}
//attach sound file to instrument and start playing
_root.instrument.attachSound("Instrumentmp3");
_root.instrument.start(0,1);
}
Scripting for the Stop Button
on (release){
//if background music is playing
if (_root.bkgrdmusicplaying!=false){
_root.bkgrdmusic.setVolume(100); //restore volume
}
//attach sound file to instrument and start playing
_root.instrument.attachSound("Instrumentmp3");
_root.instrument.start(0,1);
}
However, I keep having the problem in that if I stop one sound, all the music will stop. I did not use stopAllSound(); command anywhere. All I did was to instruct a specific instrument to stop through actionscript.
Advice please? Thanks.
p.s : How do I put an attachment of my fla file on this page?