actionscript 3 - Volume control after loop as3 -
i have problem code. code works great 1 exception, if have pressed mute-button , animation loops, it's volume = 1. how can loop without going volume = 1?
var mysound:sound = new sound(); var songurl:urlrequest = new urlrequest("lyd/jetpass.mp3"); var channel1:soundchannel = new soundchannel(); var volumeadjust:soundtransform = new soundtransform(); mute1.addeventlistener(mouseevent.click, mutelyd); volumeadjust.volume = 1; mysound.load(songurl); channel1.soundtransform = volumeadjust; channel1 = mysound.play(); function mutelyd(e:mouseevent):void { if(volumeadjust.volume == 1){ volumeadjust.volume = 0; } else { volumeadjust.volume = 1; } channel1.soundtransform = volumeadjust; }
just found out code solves problem:
var mysound:sound = new sound(); var songurl:urlrequest = new urlrequest("lyd/jetpass.mp3"); var channel1:soundchannel = new soundchannel(); mute1.addeventlistener(mouseevent.click, mutelyd); unmute1.addeventlistener(mouseevent.click, unmutelyd); mysound.load(songurl); channel1 = mysound.play(); function mutelyd(evt:mouseevent){ soundmixer.soundtransform = new soundtransform(0); unmute1.visible = true; mute1.visible = false; } function unmutelyd (evt:mouseevent){ soundmixer.soundtransform = new soundtransform(1); unmute1.visible = false; mute1.visible = true; }
Comments
Post a Comment