User Guide
Microphone 793
You have 2 device(s) installed.
[0] Logitech USB Headset
[1] YAMAHA AC-XG WDM Audio
See also
name (Microphone.name property), get (Microphone.get method)
onActivity (Microphone.onActivity handler)
onActivity = function(active:Boolean) {}
Invoked when the microphone starts or stops detecting sound. If you want to respond to this
event handler, you must create a function to process its activity value.
To specify the amount of sound required to invoke
Microphone.onActivity(true), and the
amount of time that must elapse without sound before
Microphone.onActivity(false) is
invoked, use
Microphone.setSilenceLevel().
Availability: ActionScript 1.0; Flash Player 6
Parameters
active:Boolean - A Boolean value set to true when the microphone starts detecting sound,
and false when it stops.
Example
The following example displays the amount of activity level in a ProgressBar instance called
activityLevel_pb. When the microphone detects sound, it invokes the onActivity
function, which modifies the ProgressBar instance.
var activityLevel_pb:mx.controls.ProgressBar;
activityLevel_pb.mode = "manual";
activityLevel_pb.label = "Activity Level: %3%%";
this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
active_mic.onActivity = function(active:Boolean) {
if (active) {
activityLevel_pb.indeterminate = false;
activityLevel_pb.label = "Activity Level: %3%%";
} else {
activityLevel_pb.indeterminate = true;
activityLevel_pb.label = "Activity Level: (inactive)";
}
};
this.onEnterFrame = function() {
activityLevel_pb.setProgress(active_mic.activityLevel, 100);
};