Hey.
I've serched the forums over and over to find helpful threads on how to make my movieclip avoid the mouse. I have a movieclip, a square, which I would like to have moving around on stage, avoiding the mouse if you "chase" the movieclip.

Unfortunately, all the threads I have found have been with Actionscript 1.0 or 2.0. I tried converting it to AS3, but failed.

I dont have much code so far, just the basics:

stage.addEventListener(Event.ENTER_FRAME, avoidTouch);

function avoidTouch(event:Event):void {
var distx: int = noTouch_mc.x - mouseX;
var disty: int = noTouch_mc.y - mouseY;
var afstand: int = ????;
if(afstand < distx && afstand < disty){

}
}

Im stuck. I want to make it calculate the distance from the mouse to the NoTouch_mc and if it gets below a certain number, make the noTouch_mc move away from the mouse.
If it could be made so it never leaves stage, that I'd like to incorporate too, but wouoldnt I have to consider sinus and cosinus to an angle to make it turn?
Too much math in this

Anyone have any idea how to do this? Im not a flash/AS3 expert or anything close to that. Any help is much appreciated.

(Just please dont link/refer to Actionscript 1.0 or 2.0. I simply just dont know how to convert it)