麦克风输入

2019-07-14 01:34发布

import flash.media.Microphone;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.Event; var mic:Microphone;
mic=Microphone.getMicrophone();
Security.showSettings(SecurityPanel.MICROPHONE);
mic.setLoopBack(true); var bmpd:BitmapData;
stage.align=StageAlign.TOP_LEFT;
stage.scaleMode=StageScaleMode.NO_SCALE;
bmpd=new BitmapData(400,50,false,0xffffff);
addChild(new Bitmap(bmpd));
addEventListener(Event.ENTER_FRAME,onEnter); function onEnter(event:Event):void{
 bmpd.setPixel(298,50-mic.activityLevel/2,0);
 bmpd.scroll(-1,0);
}