Skip to main content
D Herrick
Participant
April 20, 2006
Answered

Actionscript works only in 5 or lower

  • April 20, 2006
  • 2 replies
  • 348 views
So I'm using some code for eye rotation that follows mouse movement. This code only works when I output for Flash 5 or lower. Does anyone understand the math enough to help me with coding in Actionscript 2.0 for Flash 8?
Thanks in advance.

Dave

I have a graphic and instance name for eye and eye2.

// eye1 rotation
a = eye._y-_ymouse;
b = eye._x-_xmouse;
angleA = Math.atan2(a, b);
degrees = angleA/(Math.pi/180);
setProperty ("eye", _rotation, degrees);

// eye2 rotation
a2 = eye2._y-_ymouse;
b2 = eye2._x-_xmouse;
angleA2 = Math.atan2(a2, b2);
degrees2 = angleA2/(Math.pi/180);
setProperty ("eye2", _rotation, degrees2);
This topic has been closed for replies.
Correct answer Rothrock
That is strange. Right off I'm not seeing anything that would be 5 specific.

However I do think it is Math.PI and capitalization counts for Flash 7 and higher. So probably checking the spelling/caps on every command you use wouldn't hurt.

2 replies

RothrockCorrect answer
Inspiring
April 20, 2006
That is strange. Right off I'm not seeing anything that would be 5 specific.

However I do think it is Math.PI and capitalization counts for Flash 7 and higher. So probably checking the spelling/caps on every command you use wouldn't hurt.
D Herrick
D HerrickAuthor
Participant
April 20, 2006
I tested in Flash 6 and it works too. Capitalization was the key. Works in 8 now. Thanks guys.

Dave
Participating Frequently
April 20, 2006
Instead of using setProperty() try the following:

eye1._rotation = degrees;
eye2._rotation = degrees;

Tim