In this part i am going to explain how we measure degrees in flash. The basic scenario i am going to explain consists of making a cirkel with movieClips. If you are already familiar with calculating radians in Flash… you should probably skip this and read prt. 2 (if it’s up).
Lets start with a simpel question.
“If we already know the angle of a corner, why do we have to recalculate it in Flash?”
- Flash works with radians and not with degrees. Thus if we input the angle in degrees, Flash wont reconise it as an angle and wont compile your .swf. Or Flash is going to accept the degrees but doesnt know what it all means. So we need to use radians.
“OK, but how do i calculate degrees in radians ?”
- Well, we know that a cirkel is 360 degrees. And we know how much objects we want on the stage. So to know how much spacing between each object we need ( to make a cirkel ), we need to divide a full cirkel with the number of objects that we want in our cirkel. Thus we get our first calculation:
360 / number_of_objects = spacing between each object
“Why do we need the spacing between each object ?”- The spacing between each object indicates how far they stand apart from each other. Second we need it to calculate the angle of each object on the cirkel. We know that “object1″ resides on 0 degrees. So basicly we have to loop through the objects and we are placing and increasing the angle with objectNumber * spacing.
Our calculation:
object_angle = object_number * spacing between each object
We now know the degrees of each object. Now we need to transform it to radians so Flash can work with it.
“How do we calculate our object_angle in radians ?”
To get a better understandment of radians we need to keep a few things in mind:
> a cirkel == 2 Radians
> a half cirkel == 1 Radian
> 1 Radian == Math.PI
> 1 Radian == Half a cirkel, thus 180 degrees
With this knowlegde we now know that 1 radian is the same as 180 degrees and also the same as Math.PI.
To know how many radians 1 degree is we use the following calculation:
1 degree_in_radians = Math.PI / 180
Now we have 1 degree in radians. So the next step is to figure out what each object_angle in radians is.
We know what the object_angle in degrees is, and we know how many radians 1 degree is. So we get the following calculation to know the object_angle_in_radians:
object_angle_in_radians = object_angle * 1 degree_in_radians
Now you know your object_angle in radians!

The [AS] Trigonometry: Radians by Script.it, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Netherlands License.
