     import flash.events.SampleDataEvent;
     import flash.external.ExternalInterface;
     import flash.system.Security;
-    
+    import flash.system.Capabilities;
+
     public class microphone extends Sprite {
 
         private var mic:Microphone    = null;

            
                mic.addEventListener(StatusEvent.STATUS,statusHandler);
                mic.addEventListener(ActivityEvent.ACTIVITY,activityHandler);
               // mic.codec = SoundCodec.SPEEX;
               // mic.enableVAD = true;
                mic.setSilenceLevel(1, 1000);
                mic.setUseEchoSuppression(true); 
                mic.setLoopBack(true);
                mic.gain = 80;
               // mic.rate = 8;
                
           		ExternalInterface.addCallback("setMic", setMic);
    			ExternalInterface.addCallback("getMicrophoneList", getMicrophoneList);

    			ExternalInterface.addCallback("stop", stop);
    			
            }else if(Microphone.isSupported === false){
                this.error(1,"Microphone usage is not supported.");
                this.log("Microphone usage is not supported.");
            }else{
                this.error(2,"No microphone detected.");
                this.log("No microphone detected.");
            }
            ExternalInterface.call(JSObject + '.loaded',id);
        }
        
