User Guide
Microphone.onActivity 541
status_ta.text += "You have "+microphone_array.length+" device(s)
installed."+newline+newline;
for (var i = 0; i<microphone_array.length; i++) {
status_ta.text += "["+i+"] "+microphone_array[i]+newline;
}
For example, the following information could be displayed:
The default device is: Logitech USB Headset
You have 2 device(s) installed.
[0] Logitech USB Headset
[1] YAMAHA AC-XG WDM Audio
See also
Array class, Microphone.name
Microphone.onActivity
Availability
Flash Player 6.
Usage
active_mic.onActivity = function(activity:Boolean) : Void {
// your statements here
}
Parameters
activity
A Boolean value set to true when the microphone starts detecting sound, and false
when it stops.
Returns
Nothing.
Description
Event handler; 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().
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);