package // com.waku.classes { import flash.events.Event; import flash.media.Sound; import flash.media.SoundChannel; import flash.media.SoundTransform; import flash.net.URLRequest; public class student_game_wakuwaku_com_waku_classes_WakuSound { private var _soundChannel : SoundChannel; private var _soundTransform:SoundTransform; public function student_game_wakuwaku_com_waku_classes_WakuSound() { _soundChannel = new SoundChannel(); _soundTransform = new SoundTransform(); _soundChannel.soundTransform=_soundTransform; _soundTransform.volume = 1.0; } public function Play(soundUrl : String) : void { var sound : Sound = new Sound(); var req: URLRequest = new URLRequest(soundUrl); //var audio:SoundChannel = new SoundChannel(); sound.addEventListener(Event.OPEN,soundLoadCompleteHandler); sound.load(req); //"com/waku/animals/0"+ animalId.toString() + "/sound1.mp3") } private function soundLoadCompleteHandler(event:Event):void { var localSound:Sound = event.target as Sound; _soundChannel = localSound.play(0,1,_soundTransform); } public function unmute():void { _soundTransform.volume =1.0; } public function mute() : void { //var _sound:Sound = new Sound(new URLRequest("song.mp3")); _soundTransform.volume = 0.0; } } }