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

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

    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;
