Microphone.index

Availability

Flash Player 6.

Usage

active_mic.index:Number

Description

Read-only property; a zero-based integer that specifies the index of the microphone, as reflected in the array returned by Microphone.names.

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);

See also

Microphone.get(), Microphone.names

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001460.html