0

在 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); 
4

1 回答 1

0

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

video.soundTransform = new SoundTransform(0.5);

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

function setMute(vol)
{
   root.video.soundTransform = new SoundTransform(vol);
}
于 2013-07-24T03:40:17.943 回答