Game Development Reference
This returns a number in radians . Unfortunately, this is not useful for rotating Movie Clip objects.
You need to convert this number to degrees , which is the type of value expected by the nkp]pekj
To convert radians to degrees, you can use a simple calculation: multiply the value in radians by 180
divided by Pi (3.14). AS3.0 has a built-in function called I]pd*LE that returns the value of Pi, just to
make things easier for you. Here's what the final line of code might look like:
This gives you a rounded-off value in degrees:
Figure 9-20 shows what this looks like in the example.
Figure 9-20. Use AS3.0's built-in Math.atan2 function to find the angle of rotation.
Great! You now have a number you can use to rotate the frog. You can use it in a directive like this: