在FlashCom中检测摄像头和麦克风的方法

//检查摄像头 
function CheckForCam() { 
camArray = Camera.names; 
if (camArray.length >= 1){ 
temp_cam = Camera.get(); 
if(temp_cam == -1) { 
trace('--- cam is detected but its busy'); 
return -1; } 
else { 
trace('--- cam detected'); 
return 1; } 
delete temp_cam; 
} else if (camArray.length == 0) { 
trace('--- no cam detected'); 
return 0; 
// 检查麦克风 
function CheckForMic() { 
micArray = Microphone.names;; 
if (micArray.length >= 1){ 
temp_mic = Microphone.get(); 
if(temp_mic == -1) { 
trace('--- mic is detected but its busy'); 
return -1; } 
else { 
trace('--- mic detected'); 
return 1; } 
delete temp_mic; 
} else if (micArray.length == 0) { 
trace('--- no Mic detected'); 
return 0; 
}
原文地址:https://www.cnblogs.com/top5/p/2340097.html