Copy link to clipboard
Copied
When the game starts. I have toggle button. I can play a sound or stop sound. When i play the sound, of course its not muted so even if i go to the next page. I can reason out that the sounds will still play.
But if i press the no sound,so it means it must be muted.. on the first screen, the sound stops. But when I go the next frames and to others. The sounds are playing. The sound on the starting screen
was like
var test:Sound = new NameOfSound();
but in the next frames.. the sound is in the frame itself.. no declaring like the first screen..
and also some sounds is playing when something happens or for example if the bullet hits the target collsion..sound play..
i tried to have solution like on the first screen if for example it is muted.. ill set it to trueStop.. then on the next frames.. i would put:
if(trueStop == true){
SoundMixer.stopAll();
}
that way the frame sounds stopped and working.. but the sounds attach to the function when like i said if a collision happens,, the sound is still playing.. arrgghh i cant explain clearly.. i hope you understand my problem..
any ideas?
if you need to stop individual sounds, assign a soundchannel to the instance returned by your play method and apply a stop method to that soundchannel.
for example:
var s1:Sound=new S1();
var sc1:SoundChannel=s1.play();
// now at any time you can use:
sc1.stop(); // to stop s1 only.
Copy link to clipboard
Copied
if you need to stop individual sounds, assign a soundchannel to the instance returned by your play method and apply a stop method to that soundchannel.
for example:
var s1:Sound=new S1();
var sc1:SoundChannel=s1.play();
// now at any time you can use:
sc1.stop(); // to stop s1 only.
Copy link to clipboard
Copied
i have 10 sounds .. do i have to make 10 of sound channels? cause im just using the sound channel on the starting screen..
Copy link to clipboard
Copied
yes.
if you want to control each sound independently of the others, create an unique soundchannel instance for each:
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more