I'm trying to make a movie clip that changes it's alpha depending on how close the mouse is to it's center. So far, all I've gotten is a bunch of failures...here's the script that has worked the bast so far:

//determine number of pixels difference between movieclip and mouse, then set the _alpha of movieclip to half of what is returned.

movieclip.xalpha = Math.abs(movieclip._x - _xmouse);
movieclip.yalpha = Math.abs(movieclip._y - _ymouse);
movieclip.newalpha = movieclip.xalpha + movieclip.yalpha;
movieclip.newalpha = movieclip.newalpha - movieclip._x;
movieclip.newalpha = movieclip.newalpha - movieclip._y;
movieclip.newalpha = movieclip.newalpha / 2;
movieclip.newalpha = Math.abs(movieclip.newalpha);
movieclip._alpha = movieclip.newalpha;

I had to subtract the movieclip's x and y because for some reason when I traced movieclip._alpha, it was always higher than it was supposed to be by those two numbers added together. Now it works mostly (when the mouse gets closer the movieclip fades), but it also fades when the mouse is up and to the right, and down and to the left. Any suggestions?