Microphone.onActivity
Availability
Flash Player 6.
Usage
active_mic.onActivity = function(activity:Boolean) : Void {
// your statements here
}
Parameters
A Boolean value set to
activity
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
To specify the amount of sound required to invoke
amount of time that must elapse without sound before
invoked, use Microphone.setSilenceLevel().
Example
The following example displays the amount of activity level in a ProgressBar instance called
activityLevel_pb
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);
};
See also
Microphone.setSilenceLevel()
when the microphone starts detecting sound, and
true
. When the microphone detects sound, it invokes the
activity
Microphone.onActivity(true)
Microphone.onActivity(false)
Microphone.onActivity
false
value.
, and the
is
function,
onActivity
457
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers