Client-Side Communication ActionScript > Microphone.onActivity |
Microphone.onActivity
Availability
Flash Player 6. |
|
Flash Communication Server MX (not required). |
Usage
activeMicrophone.onActivity = function(activity) { // Your code here }
Parameters
activity A Boolean value set to true when the microphone starts detecting sound, 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 true or false in the Output window when the microphone starts or stops detecting sound.
m = Microphone.get();
_root.attachAudio(m);
m.onActivity = function(mode)
{
trace(mode);
};
See also