MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 546

Actionscript language reference
Table of Contents

Advertisement

Example
The following example sets the microphone rate to the user's preference (which you have assigned
to the
userRate
value is rounded to the nearest acceptable value that the sound capture device supports.
active_mic.setRate(userRate);
The following example lets you use a ComboBox instance, called
which your microphone captures sound. The current rate displays in a Label instance called
.
rate_lbl
this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());
var active_mic:Microphone = Microphone.get();
sound_mc.attachAudio(active_mic);
var rate_array:Array = new Array(5, 8, 11, 22, 44);
rate_cb.dataProvider = rate_array;
rate_cb.labelFunction = function(item:Object) {
return (item+" kHz");
};
for (var i = 0; i<rate_array.length; i++) {
if (rate_cb.getItemAt(i) == active_mic.rate) {
rate_cb.selectedIndex = i;
break;
}
}
function changeRate() {
active_mic.setRate(rate_cb.selectedItem);
rate_lbl.text = "Current rate: "+active_mic.rate+" kHz";
}
rate_cb.addEventListener("change", changeRate);
rate_lbl.text = "Current rate: "+active_mic.rate+" kHz";
See also
Microphone.rate
Microphone.setSilenceLevel()
Availability
Flash Player 6.
Usage
active_mic.setSilenceLevel(level:Number [, timeout:Number]) : Void
Parameters
An integer that specifies the amount of sound required to activate the microphone and
level
invoke
Microphone.onActivity(true)
value is 10.
An optional integer parameter that specifies how many milliseconds must elapse
timeout
without activity before Flash considers sound to have stopped and invokes
Microphone.onActivity(false)
546
Chapter 7: ActionScript for Flash
variable) if it is one of the following values: 5, 8, 11, 22, or 44. If it is not, the
. The default value is 2000 (2 seconds).
. Acceptable values range from 0 to 100. The default
, to change the rate at
rate_cb

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents