flash - actionscript on/off sound not working properly -
Actually I have two buttons on / off. If I click on the button more than once, the sound is off The button does not work any more, so I can not stop the sound. Can someone help? Import flash.media.Sound; Import Flash. Media. Sound channel; Import flash.events.MouseEvent; Var mySound: Sound = New Classical_seend (); Var myChannel: SoundChannel = new soundchannel (); MyChannel.stop (); Soundon_btn.addEventListener (Mouse Event. Paste, Sound); Function soundon (Event: MouseEvent): Zero {myChannel = mySound.play (); } SoundOFF_btn.addEventListener (MouseEvent.CLICK, soundOFF); Function Voiceoff (Event: Mouse Event): Zero {myChannel.stop (); } Why is this happening because every time you call MySound .play () A new SoundChannel object is generated to play back the sound and that function comes back from the call. So if you say it twice, the most recent voice channel object is stored in your myChannel variable; However, any first soundchannel that was generated was lost be...