In the following code how to mute the speakers
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
width="300"
height="100"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.media.*;
import flash.net.NetStream;
private var myMic:Microphone;
private var recordingState:String = "idle";
private function init():void {
myMic = Microphone.getMicrophone();
myMic.setSilenceLevel(0);
myMic.rate = 44;
myMic.gain = 100;
myMic.setUseEchoSuppression(true);
micLevel.visible = true;
//Security.showSettings(SecurityPanel.MICROPHONE);
myMic.setLoopBack(true);
if (myMic != null)
{
myMic.setUseEchoSuppression(true);
micLevel.setProgress(myMic.activityLevel, 100);
addEventListener(Event.ENTER_FRAME, showMicLevel);
//micLevel.setProgress(myMic.activityLevel, 100);
}
}
private function showMicLevel(event:Event):void{
switch (recordingState){
case "idle" :
micLevel.setProgress(myMic.activityLevel, 100);
break;
}
}
]]>
</mx:Script>
<mx:ProgressBar x="0" y="36" mode="manual" id="micLevel" label="" labelPlacement="bottom" width="100" fontSize="10" fontWeight="normal"/>
If you just want to disble the voice from microphone to come into the speakers do
myMic.setLoopBack(false);
This will disable the sound detected by microphone to be played in the speakers.
EDIT1:
//use the function to disable sound completely.
private function disableSound():void
{
var newSoundTransform:SoundTransform=new SoundTransform();
newSoundTransform.volume=0;
this.soundTransform=newSoundTransform;
}
Call the above function in init() function. This will completely disable all sounds coming from the application.