Microphone.activityLevel

Availability

Flash Player 6.

Usage

active_mic.activityLevel:Number

Description

Read-only property; 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.

Example

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

See also

Microphone.setGain()

 

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/00001457.html