Microphone.index

Availability

Usage

public index : Number [read-only]

Description

Property (read-only); 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);

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

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/fms/2/docs/00000554.html