在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; 
}
posted @ 2012-02-06 14:29  与时俱进  阅读(400)  评论(0编辑  收藏  举报
友情链接:同里老宅院民居客栈