Controlo de Volume AS 3.0
Queria controlar o som numa aplicação mas se na página principal baixar o som e mudar de página não reconhece e fica como se estivesse normal..Gostaria de saber como se faz o controlo de todo o som da aplicação.
tenho este código:
//declare a importedSound sound object that loads a library sound
var myAudioJP:vazio = new vazio();
var myChannelJP:SoundChannel = new SoundChannel();
myChannelJP = myAudioJP.play();
mute_mc.buttonMode = true;
mute_mc.gotoAndStop(2);
//an event listener to check if the music on off button is clicked
mute_mc.addEventListener(MouseEvent.MOUSE_UP, muteSoundJP);
function muteSoundJP(event:MouseEvent):void {
if (mute_mc.currentFrame == 1) {
for(var nJP:Number = 1; nJP<5; nJP++) {
this["vol" + nJP].alpha = 1
}
//All sound channels
SoundMixer.soundTransform = new SoundTransform(1);
mute_mc.gotoAndStop(2);
} else {
for(nJP = 1; nJP<5; nJP++) {
this["vol" + nJ].alpha = 0.5
}
SoundMixer.soundTransform = new SoundTransform(0);
mute_mc.gotoAndStop(1);
}
}
//an event listener to check if the volume button is clicked
for(var nJP:Number = 1; nJP<5; nJP++) {
this["vol" + nJP].vol = nJP
this["vol" + nJP].addEventListener(MouseEvent.MOUSE_UP, changeVolumeJP);
this["vol" + nJP].buttonMode = true
}
function changeVolumeJP(e:Event):void {
//Without a sound channel:
var sTransform:SoundTransform = new SoundTransform();
sTransform.volume = (e.currentTarget.vol/6 * 100) * 0.01;
myChannelJP.soundTransform = sTransform;
for(var nJP:Number = 1; nJP<5; nJP++) {
if(nJP < e.currentTarget.vol + 1) {
this["vol" + nJP].alpha = 1
} else {
this["vol" + nJP].alpha = 0.5
}
}
}
myChannelJP.addEventListener(Event.SOUND_COMPLETE, myPlaybackCompleteJP);
function myPlaybackCompleteJP(event:Event):void {
myChannelJP = myAudioJP.play();
}Discussão (1)
Carregando comentários...