Groups | Blog | Home
all groups > flash actionscript > november 2005 >

flash actionscript : My Eyes aren't working.


sk8bordgeek
11/18/2005 9:06:04 PM
sampurtill
11/18/2005 9:24:30 PM
Woah. How are you trying to get it to follow the cursor? Your code and your way
of doing it is jjaacckkeedd. Specify how you want the eye to follow the mouse
and I'll be able to help you better.

Sam
juankpro
11/18/2005 9:28:15 PM
eyeFollow = function () {
var mouseDistX = this._parent._xmouse-_x;
var mouseDistY = this._parent._ymouse-_y;

var angle = 180*Math.atan2(mouseDistY, mouseDistX)/Math.PI;
var mouseDist = Math.sqrt(mouseDistX*mouseDistX+mouseDistY*mouseDistY);
var mouseDistInt = Math.floor(mouseDist/3)+1;

if (mouseDistInt>101) {
this.gotoAndStop(101);
} else {
this.gotoAndStop(mouseDistInt);
}
this._rotation = angle;
};
eyes.pupil.onEnterFrame = eyeFollow;
AddThis Social Bookmark Button