ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > Microphone > activityLevel (Microphone.activityLevel property) | |||
public activityLevel : Number [read-only]
A numeric value that specifies the amount of sound the microphone is detecting. Values range from 0 (no sound is being detected) to 100 (very loud sound is being detected). The value of this property can help you determine a good value to pass to the Microphone.setSilenceLevel() method.
If the microphone is available but is not yet being used because Microphone.get() has not been called, this property is set to -1.
Availability: ActionScript 1.0; Flash Player 6
The following example displays the activity level of the current microphone in a ProgressBar instance called activityLevel_pb.
var activityLevel_pb:mx.controls.ProgressBar;
activityLevel_pb.mode = "manual";
activityLevel_pb.label = "Activity Level: %3%%";
activityLevel_pb.setStyle("themeColor", "0xFF0000");
this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
this.onEnterFrame = function() {
activityLevel_pb.setProgress(active_mic.activityLevel, 100);
};
active_mic.onActivity = function(active:Boolean) {
if (active) {
var haloTheme_str:String = "haloGreen";
} else {
var haloTheme_str:String = "0xFF0000";
}
activityLevel_pb.setStyle("themeColor", haloTheme_str);
};
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.
get (Microphone.get method), setSilenceLevel (Microphone.setSilenceLevel method), setGain (Microphone.setGain method)
|
|
|
|