2009-09-07 49 views
0
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); 
    } 
+0

評論看起來很具描述性。你能更清楚你不明白的東西嗎?一個錯誤的標題和代碼轉儲不是一個好問題。 – 2009-09-07 19:15:22

回答

0

這是ActionScript 2的,你必須得到Flash IDE的副本或使用mtasc命令行編譯器從該代碼創建一個swf。您可以在Flash播放器或安裝了Flash插件的瀏覽器中查看swf。

或者那不是你問什麼?

相關問題