Setgain (Microphone.setgain Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following code lets you use a ComboBox instance, called
which your microphone captures sound. The current rate displays in a Label instance called
.
rate_lbl
this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
var rate_array:Array = new Array(5, 8, 11, 22, 44);
rate_cb.dataProvider = rate_array;
rate_cb.labelFunction = function(item:Object) {
return (item+" kHz");
};
for (var i = 0; i<rate_array.length; i++) {
if (rate_cb.getItemAt(i) == active_mic.rate) {
rate_cb.selectedIndex = i;
break;
}
}
function changeRate() {
active_mic.setRate(rate_cb.selectedItem);
rate_lbl.text = "Current rate: "+active_mic.rate+" kHz";
}
rate_cb.addEventListener("change", changeRate);
rate_lbl.text = "Current rate: "+active_mic.rate+" kHz";
The
MovieClip.getNextHighestDepth()
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
See also
setRate (Microphone.setRate method)

setGain (Microphone.setGain method)

public setGain(gain:Number) : Void
Sets the microphone gain--that is, the amount by which the microphone should multiply the
signal before transmitting it. A value of 0 tells Flash to multiply by 0; that is, the microphone
transmits no sound.
You can think of this setting like a volume knob on a stereo: 0 is no volume and 50 is normal
volume; numbers below 50 specify lower than normal volume, while numbers above 50
specify higher than normal volume.
Availability: ActionScript 1.0; Flash Player 6
796
ActionScript classes
method used in this example requires Flash Player
MovieClip.getNextHighestDepth()
, to change the rate at
rate_cb
method.

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF