---
title: "麦克风输入"
author: "wwww2"
date: "2012-07-09T21:33:14Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2012-07-09T21:33:14Z"
id: 1583422
url: "https://wwww2.iteye.com/blog/1583422"
---

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