index (Microphone.index property)

public index : Number [read-only]

A zero-based integer that specifies the index of the microphone, as reflected in the array returned by Microphone.names.

Availability: ActionScript 1.0; Flash Player 6

Example

The following example displays the names of the sound capturing devices available on your computer system in a ComboBox instance called mic_cb. An instance of the Label component, called mic_lbl, displays the index microphone. You can use the ComboBox to switch between the devices.

var mic_lbl:mx.controls.Label;
var mic_cb:mx.controls.ComboBox;

this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
mic_lbl.text = "["+active_mic.index+"] "+active_mic.name;
mic_cb.dataProvider = Microphone.names;
mic_cb.selectedIndex = active_mic.index;

var cbListener:Object = new Object();
cbListener.change = function(evt:Object) {
    active_mic = Microphone.get(evt.target.selectedIndex);
    sound_mc.attachAudio(active_mic);
    mic_lbl.text = "["+active_mic.index+"] "+active_mic.name;
};
mic_cb.addEventListener("change", cbListener);

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components' DepthManager class instead of the MovieClip.getNextHighestDepth() method.

See also

get (Microphone.get method), names (Microphone.names property)