动作脚本3中的静音按钮

时间:2012-05-14 19:08:27

标签: actionscript-3 button mute

所以这是我的问题。我有一个可展开的横幅。展开时视频开始播放。我的任务是在视频中插入声音的开/关按钮,然后我就这样做了。但问题是我无法触及我的按钮,因为当我尝试将鼠标移动到按钮时,可扩展区域消失,因为我正在移动到按钮区域。这也是代码。

import flash.events.Event;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.media.SoundTransform;    
import flash.media.SoundMixer;


cierre.gotoAndStop(1);
SoundMixer.soundTransform = new SoundTransform(0); 
video_player.autoPlay = true;
video_player.source = "video_500x374.f4v";

video_player.addEventListener(Event.COMPLETE, finVideo);

stop();


b2_btn.buttonMode = true;
b2_btn.addEventListener(MouseEvent.MOUSE_OUT, aBanner1);
b2_btn.addEventListener(MouseEvent.CLICK,onClick);





var clicktag=(stage.loaderInfo.parameters.clickTag)?  stage.loaderInfo.parameters.clickTag:"http://www.vasava.es";
function onClick(e:MouseEvent){
navigateToURL(new URLRequest(clicktag),"_blank");
}




function aBanner1(e:Event):void{
video_player.stop();
this.gotoAndStop(1);
}

function finVideo(e:Event):void{
video_player.stop();
cierre.play();
}

function setMute(vol) {
var sTransform:SoundTransform = new SoundTransform (0,1);
sTransform.volume = vol;
SoundMixer.soundTransform = sTransform; 
}
var Mute:Boolean = false;
mutebutton.addEventListener (MouseEvent.CLICK,toggleMuteBtn);

function toggleMuteBtn (event:Event) {
if(Mute) {
    Mute = false;
    setMute(0);

}else{
    Mute = true;
    setMute(1);
}
}      

1 个答案:

答案 0 :(得分:0)

将静音按钮放入横幅本身的扩展部分,或者只需让展开的横幅自动静音,无需按第二个按钮。使用哪个取决于您的具体应用和客户要求。