hi, how to count how many times the btn have been click. After counted the number of btn been click , according to the number , load the sound that match with the number of the btn been click.
i upload the fla zip file to here.anyone who know how to do it , plz reply me.thanks.
At the first frame :
Sound = new Sound();
Sound.attachSound("firstSound01.wav","secondSound02.wav");
At the btn's action:
b’cos of the file is too big i can’t attach here,so i post the code here.With using these code, the sound come out when i click the btn is firstSound01.wav,the second time i click the btn the sound come out still firstSound01.wav.How to make it come out secondSound02.wav when i click the btn after first sound finish.
There are a few errors in your code. Try something like this:
//at the first frame
my_sound = new Sound(this);
//on the button
on (release) {
count++;
switch (count) {
case 1 :
id = "firstSound01.wav";
break;
case 2 :
id = "secondSound02.wav";
break;
case 3 :
id = "thirdSound03.wav";
break;
default :
id = "forthSound04.wav";
}
_root.my_sound.attachSound(id);
_root.my_sound.start(0, 1);
}
To work with attached sounds you must to give a linkage name to the sound file in the library, so you can reference it.
Right click the sound file in the library, linkage, and check the export for actionscript option.
hi,the linkage which u told me i ady done when i import the sound file into the flash library.
so wat is the problem??is what i type for the sound fine name correct??
on(press){
switch(mycounter){
case 0:
id = "firstSound01.wav";
break;
case 1:
id = "secondSound02.wav";
break;
case 2:
id = "thirdSound03.wav";
break;
default:
id = "fourthSound04.wav";
break;
}
mycounter++
}