Macromedia flash media server 2-client-side actionscript language reference for flash media server 2 User Manual
42
Client-Side ActionScript Language Reference
Microphone.gain
Availability
■
Flash Player 6.
■
Flash Media Server (not required).
Usage
public gain : Number [read-only]
Description
Property (read-only); the amount by which the microphone boosts the signal. Valid values
are 0 to 100. The default value is 50.
are 0 to 100. The default value is 50.
Example
The following example uses a ProgressBar instance called
gain_pb
to display and a
NumericStepper instance called
gain_nstep
to set the microphone's gain value:
this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
gain_pb.label = "Gain: %3";
gain_pb.mode = "manual";
gain_pb.setProgress(active_mic.gain, 100);
gain_nstep.value = active_mic.gain;
gain_pb.mode = "manual";
gain_pb.setProgress(active_mic.gain, 100);
gain_nstep.value = active_mic.gain;
function changeGain() {
active_mic.setGain(gain_nstep.value);
gain_pb.setProgress(active_mic.gain, 100);
}
gain_nstep.addEventListener("change", changeGain);
active_mic.setGain(gain_nstep.value);
gain_pb.setProgress(active_mic.gain, 100);
}
gain_nstep.addEventListener("change", changeGain);
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
Component Architecture), use the DepthManager class from the component framework
instead of the
MovieClip.getNextHighestDepth()
method.
See also