Possible to use setinterval to control this script?

I am using this random motion script, i tried to control the speed by using microphone… the only possible way so far i know :crying: is using setinterval and links the interval together with mic value…:crying: but is it possible? i have tried few times and it is not working so far…:crying:

acceleration = 3
newpos = function () {
ranx = Math.round((Math.random ()*300));
rany = Math.round ((Math.random ()*450));
}
newpos();
this.onEnterFrame = function() {
this._x += ((ranx-this._x)/acceleration);
this._y += ((rany-this._y)/acceleration);
if (Math.round(this._x) == ranx || Math.round(this._y) == rany) {
newpos();
}
};

what did you do with the microphone ???

my project needs to use the mic to control the speed…but i cant figure it out :frowning:

mic = Microphone.get();
mic.setUseEchoSuppression(true);
mic.useEchoSuppression;
myMC.attachAudio(mic);
onEnterFrame = function () {
	if (myMC._x > Stage.width - 50) {
		myMC._x = 50;
	} else {
		myMC._x += mic.activityLevel;
	}
};