03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

The following example uses a ProgressBar instance called gain_pb to display <strong>and</strong> a<br />

NumericStepper instance called gain_nstep to set the microphone's gain value.<br />

this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());<br />

var active_mic:Microphone = Microphone.get();<br />

sound_mc.attachAudio(active_mic);<br />

gain_pb.label = "Gain: %3";<br />

gain_pb.mode = "manual";<br />

gain_pb.setProgress(active_mic.gain, 100);<br />

gain_nstep.value = active_mic.gain;<br />

function changeGain() {<br />

active_mic.setGain(gain_nstep.value);<br />

gain_pb.setProgress(active_mic.gain, 100);<br />

}<br />

gain_nstep.addEventListener("change", changeGain);<br />

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player<br />

7 or later. If your SWF file includes a version 2 component, use the version 2 components'<br />

DepthManager class instead of the MovieClip.getNextHighestDepth() method.<br />

See also<br />

setGain (Microphone.setGain method)<br />

get (Microphone.get method)<br />

public static get([index:Number]) : Microphone<br />

Returns a reference to a Microphone object for capturing audio. To actually begin capturing<br />

the audio, you must attach the Microphone object to a MovieClip object (see<br />

MovieClip.attachAudio()).<br />

Unlike objects that you create using the new constructor, multiple calls to Microphone.get()<br />

reference the same microphone. Thus, if your script contains the lines mic1 =<br />

Microphone.get() <strong>and</strong> mic2 = Microphone.get(), both mic1 <strong>and</strong> mic2 reference the same<br />

(default) microphone.<br />

798 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!