By monitoring the sample data being returned from the Android device microphone through the ActionScript Microphone
API, we can gather much information about the sound being captured, and perform responses within our application. Such input can be used in utility applications, learning modules, and even games.
We will set up an event listener to respond to sample data reported through the Microphone
API:
1. First, import the following classes into your project:
import flash.display.Sprite; import flash.display.Stage; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.SampleDataEvent; import flash.media.Microphone; import flash.text.TextField; import flash.text.TextFormat;
2. Declare a
TextField
andTextFormat
object pair to allow visible output upon the device. AMicrophone
object must also be declared for this example:private var mic:Microphone; private var traceField:TextField; private...