Copy link to clipboard
Copied
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.media.Microphone;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
public class sound extends MovieClip {
private var _mic:Microphone;
private var _sx:Number=0;
private var sb:Number =_sx;
public function sound(){
into();
}
private function into():void{
_mic = Microphone.getMicrophone();
_mic.setLoopBack(true);
addEventListener(Event.ENTER_FRAME, onFrame);
}
private function onFrame(event:Event): void {
_sx *=.9;
_sx +=.4;
_sx -=_mic.activityLevel * .05;
big.height +=_sx;
}
}
}
Copy link to clipboard
Copied
"big" has no height property.. what is the type of the "big" object?
Copy link to clipboard
Copied
Look like you try to work with microphone amplitude, show microphone data gain to bar. Maybe "big" is a display object like sprite. Try use graphics might help:
big.graphics.clear();
big.graphics.beginFill(0x00FF00);
big.graphics.drawRect(0, 0, _width, _sx);
big.graphics.endFill();
Find more inspiration, events, and resources on the new Adobe Community
Explore Now