ITeye博客

麦克风输入

wwww2 · 2012-07-09 21:33 · flash · Web前端 · Markdown

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);
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。