麦克风检测的ActionScript 3麦克风、ActionScript

2023-09-08 14:23:32 作者:疯癫小男人

我有几个问题检测麦克风是否检测与否。我运行功能 Microphone.getMicrophone(),而应返回的空如果没有连接麦克风,或者如果用户点击拒绝保安事务委员会上,对吧?

我现在面临的问题是,在某些计算机里没有安装麦克风, Microphone.getMicrophone()仍然描绘出如 [对象话筒]

所以说,例如用户没有麦克风,并点击允许在安全面板,我无法验证是否切换到不同的控件。

如果任何人都可以阐明如何检测一些轻,如果没有麦克风的连接,那么我所有的耳朵。

许多在此先感谢, 请问

解决方案

  VAR MIC:麦克风= Microphone.getMicrophone();

尝试 {
    micName = mic.name
    跟踪(mic.name+ mic.name)
}赶上(五:错误){
    跟踪(没有检测到话筒)
}
 

action script viewer action script错误

I'm having a few problems detecting whether a microphone is detected or not. I'm running the function Microphone.getMicrophone() and that should return null if there is no microphone attached, or if the user has clicked Deny on the security panel, right?

The problem I'm facing is, on some computers where there is no microphone installed, Microphone.getMicrophone() still traces out as [object Microphone].

So say for example the user doesn't have a microphone, and clicks allow in the security panel, I can't validate whether to switch to different controls.

If anybody can shed some light on how to detect if there is no microphone connected, then I'm all ears.

Many thanks in advance, Will

解决方案

var mic:Microphone          = Microphone.getMicrophone();

try {
    micName = mic.name
    trace("mic.name "+mic.name)
} catch (e:Error) {
    trace("no mic detected")
}