I have some Actionscript code; what will it do?

Tag: flash Author: wang2ili Date: 2009-08-22
var mic:Microphone = null;  
   function toggleVoice(isOn:Boolean)  
    //setup the mic  
    if (mic == null)  
        //call Microphone.get() to access the microphone and prompt user with Allow/Decline dialog  
        mic = Microphone.get(); 
       //Microphone.get() will return null if user declined access  
       if (mic == null)  
      //setup onActivity handler to get notification of mic activity  
      mic.onActivity = function(active:Boolean)  
         //call out to JavaScript bridge via ExternalInterface  
         flash.external.ExternalInterface.call("IsTalking", active);  
       //create movie clip and attach mic to clip so we can hear output  
       this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());  
     //set the microphone gain as per the isOn input variable  
     mic.setGain(isOn ? 50 : 0);  
The comments seem pretty descriptive. Can you be more clear about what you don't understand? A badly phrased title and a code dump isn't a good question.

Other Answer1

This is actionscript 2, you have to get a copy of the Flash IDE or use the mtasc command line compiler to create a swf from this code. The swf you can view in the flash player or in a browser that has the flash plugin installed.

Or is that not what you are asking?