将声音静音按钮添加到视频对象

时间:2013-07-23 11:35:54

标签: object button video camera mute

在Flash ActionScript 3.0中。我通过附加摄像机和视频类为舞台添加了一个视频对象。我还创建了一个简单的静音/取消静音按钮。我想将此声音按钮嵌入到视频对象中,以便为客户提供更多选项。无论如何我可以将静音按钮合并到视频对象中吗?这是我的代码:我也不会展示它,但是在这里有任何帮助都非常感谢!!

var nc:NetConnection = new NetConnection();

nc.addEventListener(NetStatusEvent.NET_STATUS, netHandler);

nc.connect(rtmfp://example);

cam:Camera = Camera.getCamera(); 
    var vid:Video = new Video(); 
    camera.setMode(720,540,15,true);
    camera.setQuality(0, 100);

    vid.attachCamera(cam); 
    video.width = camera.width;
    video.height = camera.height;

    addChild(vid);

  function setMute(vol){
   var sTransform:SoundTransform = new SoundTransform(1,0);
   sTransform.volume = vol;
   SoundMixer.soundTransform = sTransform;
}

  var isMuted:Boolean = false;
  mute_Btn.addEventListener(MouseEvent.CLICK, toggleMuteBtn);

  function toggleMuteBtn(event:MouseEvent):void{
     if(isMuted){
     isMuted = false;
     setMute(1);

    } else {
    isMuted = true;
    setMute(0); 

1 个答案:

答案 0 :(得分:0)

将视频添加到舞台后,即可执行此操作;

video.soundTransform = new SoundTransform(0.5);

或在你的情况下,像... ...

function setMute(vol)
{
   root.video.soundTransform = new SoundTransform(vol);
}