如果在ActionScript 3中允許或不允許麥克風訪問,我想測試和寫入,但現在,如果沒有編譯錯誤,它不會問我麥克風訪問,我啓動SWF文件。Actionscript 3:錯誤#1009
這是我的代碼:
import flash.display.MovieClip;
import flash.events.StatusEvent;
import flash.media.Microphone;
var mic:Microphone = Microphone.getMicrophone();
if(mic){
mic.addEventListener(StatusEvent.STATUS, this.onMicStatus);
}
else{
trace("No micro");
}
function onMicStatus(event: StatusEvent): void {
if (event.code == "Microphone.Unmuted") {
trace("Microphone access was allowed.");
} else if (event.code == "Microphone.Muted") {
trace("Microphone access was denied.");
}
}
使用調試器獲取實際行號,這很有幫助。你還應該導入'StatusEvent',而不是'Microphone'(這可能是問題)。 'import flash.events.StatusEvent' – BadFeelingAboutThis