我有一个soundTransform问题。

时间:2013-06-21 13:28:16

标签: actionscript-3 flash audio mute

我知道我在这里错过了一些愚蠢的东西。谁能伸出援助之手?我想静音,让mcs看不见。我在声音转换位上做错了。在AS3上很新。

var isPlayingMC:MovieClip =mc1;; 
var isPlayingMCcurrentFrame = 0;

var soundTr:SoundTransform = new SoundTransform();
soundTr.volume = 1;

btn1.addEventListener(MouseEvent.CLICK, playMC1); 
function playMC1(e:MouseEvent):void {

    isPlayingMCcurrentFrame = isPlayingMC.currentFrame; 
    isPlayingMC = mc1; 
    isPlayingMC.gotoAndPlay(isPlayingMCcurrentFrame);
    mc2.volume = 0;
    mc3.volume = 0;
    mc3.visible = false;
    mc2.visible = false;
    mc1.visible = true
}

btn2.addEventListener(MouseEvent.CLICK, playMC2); 
function playMC2(e:MouseEvent):void {

    isPlayingMCcurrentFrame = isPlayingMC.currentFrame; 
    isPlayingMC = mc2; 
    isPlayingMC.gotoAndPlay(isPlayingMCcurrentFrame);
    mc1.volume = 0;
    mc3.volume = 0;
    mc1.visible = false;
    mc3.visible = false;
    mc2.visible = true

} 
Btn3.addEventListener(MouseEvent.CLICK, playMC3); 
function playMC3(e:MouseEvent):void {
    isPlayingMCcurrentFrame = isPlayingMC.currentFrame; 
    isPlayingMC = mc3; 
    isPlayingMC.gotoAndPlay(isPlayingMCcurrentFrame);
    mc1.volume = 0;
    mc2.volume = 0;
    mc1.visible = false;
    mc2.visible = false;
    mc3.visible = true
    }

1 个答案:

答案 0 :(得分:0)

您需要将SoundTransform实际应用于MovieClip,因为它们没有简单的volume属性:

var st1:SoundTransform = new SoundTransform();
st1.volume = 0;
mc1.soundTransform = st1;

Here's相关参考文件。