actionscript-3 - 我有一个soundTransform问题。

标签 actionscript-3 flash audio mute

我知道我在这里想念一些愚蠢的东西。有人可以帮忙吗?我正在尝试静音并使mcs不可见。我在soundtransform位上做错了什么。 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
    }

最佳答案

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

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

Here's相关引用文档。

关于actionscript-3 - 我有一个soundTransform问题。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17236490/

相关文章:

iOS - 更新多任务栏中的媒体播放/暂停状态

javascript - 两次播放后动态声音不播放

actionscript-3 - AS3 : How to force parameters in callback functions

actionscript-3 - 从 ActionScript 3 中的字符串实例化一个类

actionscript-3 - 场景图形/显示列表之外的 AS3 事件冒泡

regex - AS3 : RegExp exec method in loop problem

javascript - 有什么方法可以测试移动浏览器是否支持使用网络技术的 Flash?

flash - 横向卷轴游戏的数据结构

php - MP3 播放器,如grooveshark

android - 在Android应用中阻止 “play”耳机按钮