我有一些Actionscript代码;它会做什么?

时间:2009-09-07 18:54:12

标签: flash

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)  
         return;  
      //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());  
       sound_mc.attachAudio(active_mic);  
     } 
     //set the microphone gain as per the isOn input variable  
     mic.setGain(isOn ? 50 : 0);  
   }

1 个答案:

答案 0 :(得分:0)

这是actionscript 2,您必须获取Flash IDE的副本或使用mtasc命令行编译器从此代码创建swf。您可以在Flash播放器或安装了Flash插件的浏览器中查看swf。

或者那不是你要问的?