PDA

View Full Version : [AS2] VideoComponent, how to mute by script?


squadjot
01-17-2010, 03:27 PM
Hi, i would like to mute my video component.
The important thing is that the skin should reflect it.. (ClearOverPlaySeekMute.swf)
so setting volume to 0 is not what i'm looking for.

Is this possible?

squadjot
01-17-2010, 04:05 PM
Oke, i found out and made this little function



var flvComponentMute:Function = function(flvpb,setToMute:Boolean):Boolean{
if(setToMute == true){
flvpb.volume = 0;
flvpb["_uiMgr"]["_lastvolumePos"] = 1;
flvpb["_uiMgr"]["_isMuted"] = true;
}else if(setToMute == false){
flvpb.volume = 100;
flvpb["_uiMgr"]["_lastvolumePos"] = 99;
flvpb["_uiMgr"]["_isMuted"] = false;
}
return flvpb["_uiMgr"]["_isMuted"];
}


Usage example:


//get mute
isMute = flvComponentMute(myFlvPlayback)

//mute
flvComponentMute(myFlvPlayback,true)

//unmute
flvComponentMute(myFlvPlayback,false)

//custom muteToggle
var toggleMute:Function = function():Void{
flvComponentMute(myFlvPlayback,!flvComponentMute(f lvComponentMute))
}