Hopefully this new version will work a lot more efficiently than the previous version. Heres the source.
// Get Microphone
var mic:Microphone = Microphone.getMicrophone();
if (mic != null) {
mic.setUseEchoSuppression(true);
mic.setLoopBack(true);
}
// Microphone level update timer
var myTimer:Timer = new Timer(10, 0);
myTimer.addEventListener("timer", timerHandler);
myTimer.start();
function timerHandler(event:TimerEvent):void {
vUBar.scaleX = mic.activityLevel / 100;
updateBlocks();
}
var myBlocks:Array = [];
function registerBlock( block:MovieClip ):void {
myBlocks.push(block);
}
function updateBlocks():void {
for each (block in myBlocks) {
if ( block.hitTestObject(vUBar) ) {
if ( block.alpha < alpha =" block.alpha"> -1 ) {
block.alpha = block.alpha - 0.05;
}
}
}
}
No comments:
Post a Comment