【问题标题】:Add a Sound Mute Button to a Video Object将静音按钮添加到视频对象
【发布时间】:2013-07-23 11:35:54
【问题描述】:

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

【问题讨论】:

    标签: object button video camera mute


    【解决方案1】:

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

    video.soundTransform = new SoundTransform(0.5);
    

    或者在你的情况下,类似...

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

    【讨论】:

      猜你喜欢
      • 2016-03-31
      • 1970-01-01
      • 1970-01-01
      • 2020-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-02
      相关资源
      最近更新 更多