Client-Side Communication ActionScript > Microphone.names

 

Microphone.names

Availability

Flash Player 6.

Flash Communication Server MX (not required).

Usage

Microphone.names

Note: The correct syntax is Microphone.names. To assign the return value to a variable, use syntax like micArray = Microphone.names. To determine the name of the current microphone, use activeMicrophone.name.

Description

Read-only class property; retrieves an array of strings reflecting the names of all available sound capture devices (including sound capture cards and microphones) without displaying the Flash Player Privacy Settings panel. This array behaves the same as any other ActionScript array, implicitly providing the zero-based index of each sound capture device and the number of sound capture devices on the system (by means of Microphone.names.length). For more information, see the Array (object) entry in the online Flash ActionScript Dictionary in the Flash MX Help menu.

Calling Microphone.names requires an extensive examination of the hardware, and it may take several seconds to build the array. In most cases, you can just use the default microphone.

Example

The following code returns information on the array of audio devices.

allMicNames = Microphone.names;
_root.debugWindow += "Microphone.names() located these device(s):" + newline;

for(i=0; i < allMicNames.length; i++){
	debugWindow += "[" + i + "]: " + allMicNames[i] + newline;
}

For example, the following information could be displayed:

Microphone.names() located these device(s):
[0]: Crystal SoundFusion(tm)
[1]: USB Audio Device

See also

Array (object) in the online Flash ActionScript Dictionary in the Flash MX Help menu, Microphone.name