I HAVE 4 SOUND BUTTONS SEPARATELY AND THE 5TH BUTTON I WANT stop all sound on a click and then resume all sound after another click.
1ST STEP: ON FIRST LAYER'S FIRST FRAME I GOT THIS CODE
// here is where you create the sound objects:
sound1 = new Sound();
sound2 = new Sound();
sound3 = new Sound();
sound4 = new Sound();
sound5 = new Sound();
// next we attach the sound from the library
// to the sound object:
sound1.attachSound("first sound"
;
sound2.attachSound("second sound"
;
sound3.attachSound("third sound"
;
sound4.attachSound("fourth sound"
;
sound5.attachSound("fifth sound"
;
// This is important - If you look in the library
// you'll see that the name of sound 1 is just '1'.
// If you left click on '1' in the library and then
// click on 'linkage' you'll see that I checked the
// 'Export this symbol' button and given the sound
// an identifier name of 'first sound'. This is so
// that when you create the swf file, the sound is
// included in the swf file as 'first sound'. I did
// the same for the other sounds as well, giving
// sound '2' the identifier 'second sound', etc.
NOW THE CODE ON 4 BUTTONS ARE BELOW
1ST BUTTON CODE
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound2.stop();
sound3.stop();
sound4.stop();
sound5.stop();
// and tell the first sound to play (the 0 means 0 seconds delay and the 500 means i'm going to loop the sound 500 times):
sound1.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (2);
}
////////////////////////////////////////
NOW CODE ON 2ND BUTTON
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound1.stop();
sound3.stop();
sound4.stop();
sound5.stop();
// and tell the first sound to play:
sound2.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (3);
}
///////////////////////////////////////////////////////
NOW CODE ON 3RD BUTTON
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound1.stop();
sound2.stop();
sound4.stop();
sound5.stop();
// and tell the first sound to play:
sound3.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (4);
}
///////////////////////////////////////////////////////
NOW CODE ON 4TH BUTTON
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound1.stop();
sound2.stop();
sound3.stop();
sound5.stop();
// and tell the first sound to play:
sound4.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (5);
}
////////////////////////////////////////////////////
NOW CODE ON 5TH BUTTON
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound1.stop();
sound2.stop();
sound3.stop();
sound4.stop();
// and tell the first sound to play:
sound5.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (6);
}
//////////////////////////////
//trying to stop all sound on a click and then resume all sound after another click
AND NOW THIS CODE IS ON MUTE BUTTON WHICH IS WORKING NOT PROPERLY
on (release) {
if (_root.clicked) {
stopAllSounds(); // stops all sounds if clicked
} else {
for (i=1;i<=5;i++) {
_root["sound"+i].play(); // resume all sounds
}
}
_root.clicked = !_root.clicked; // reset _root.clicked
}
PLEASE TELL ME WHAT THE HECK PROBLEM WITH MY MUTE CODE AND WHY IT IS NOT WORKING PROPERLY
1ST STEP: ON FIRST LAYER'S FIRST FRAME I GOT THIS CODE
// here is where you create the sound objects:
sound1 = new Sound();
sound2 = new Sound();
sound3 = new Sound();
sound4 = new Sound();
sound5 = new Sound();
// next we attach the sound from the library
// to the sound object:
sound1.attachSound("first sound"
sound2.attachSound("second sound"
sound3.attachSound("third sound"
sound4.attachSound("fourth sound"
sound5.attachSound("fifth sound"
// This is important - If you look in the library
// you'll see that the name of sound 1 is just '1'.
// If you left click on '1' in the library and then
// click on 'linkage' you'll see that I checked the
// 'Export this symbol' button and given the sound
// an identifier name of 'first sound'. This is so
// that when you create the swf file, the sound is
// included in the swf file as 'first sound'. I did
// the same for the other sounds as well, giving
// sound '2' the identifier 'second sound', etc.
NOW THE CODE ON 4 BUTTONS ARE BELOW
1ST BUTTON CODE
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound2.stop();
sound3.stop();
sound4.stop();
sound5.stop();
// and tell the first sound to play (the 0 means 0 seconds delay and the 500 means i'm going to loop the sound 500 times):
sound1.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (2);
}
////////////////////////////////////////
NOW CODE ON 2ND BUTTON
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound1.stop();
sound3.stop();
sound4.stop();
sound5.stop();
// and tell the first sound to play:
sound2.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (3);
}
///////////////////////////////////////////////////////
NOW CODE ON 3RD BUTTON
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound1.stop();
sound2.stop();
sound4.stop();
sound5.stop();
// and tell the first sound to play:
sound3.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (4);
}
///////////////////////////////////////////////////////
NOW CODE ON 4TH BUTTON
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound1.stop();
sound2.stop();
sound3.stop();
sound5.stop();
// and tell the first sound to play:
sound4.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (5);
}
////////////////////////////////////////////////////
NOW CODE ON 5TH BUTTON
on (press) {
// first I'll shut off all the other sounds that may be playing:
sound1.stop();
sound2.stop();
sound3.stop();
sound4.stop();
// and tell the first sound to play:
sound5.start(0,500);
// and this just tells which music clip is currently playing - this part isn't really neccessary:
mcWhichSound.gotoAndStop (6);
}
//////////////////////////////
//trying to stop all sound on a click and then resume all sound after another click
AND NOW THIS CODE IS ON MUTE BUTTON WHICH IS WORKING NOT PROPERLY
on (release) {
if (_root.clicked) {
stopAllSounds(); // stops all sounds if clicked
} else {
for (i=1;i<=5;i++) {
_root["sound"+i].play(); // resume all sounds
}
}
_root.clicked = !_root.clicked; // reset _root.clicked
}
PLEASE TELL ME WHAT THE HECK PROBLEM WITH MY MUTE CODE AND WHY IT IS NOT WORKING PROPERLY