Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
Many of the types of Flash games that are possible to create using the combinations of simple scripts that I cover here require the use and manipulation of angles, so let's cover how to work with angle measurements and manipulations in ActionScript. Several math class methods use the measure of an angle in degrees as a parameter; 14 degrees, 15 degrees, 25 degrees and so on. However, more methods of the math class expect circular measurements in units of radians rather than degrees. On the other hand, it's often easier to use degrees when working with angles so converting between these two types of units is a common use of the math class. You can use this equation to convert degrees to radian values before using them as a value in a method parameter. Radians equals degrees times math.pi divided by 180. You can also do your conversion like this where you're providing the entire right side of the equation with the angles measured in degrees in place of radians right here; degrees times math.pi divided by 180. So here I'm passing the equation as a parameter to calculate the sine of a 45-degree angle but I'm actually using radians, which the sine function requires right there. This is actually the same as writing it this way: math.sin open parentheses.7854 close parentheses. Here's a working script example for converting between degrees and radians. First set up a variable; degrees equals 121 semicolon. Setup another variable: radians equals degrees times my math.pi divided by 180 section of the script there. Then I'm going to go ahead and trace the radians and I should get that number there; 2.118 so on. So if I do a Control Test Movie, notice that here in the output panel I trace out the correct value. That's the radian equivalent of 121 degrees. You can see that degrees is easier to work with so you'll be converting back and forth quite often. Now, two members of the math class where you will be using this angle to radian conversion are the cosine and sine functions so let's now move on to the next movie and review scripts involving these two important math functions.
| Course: | Adobe Flash ActionScript 3.0 for Designers |
| Author: | James Gonzalez |
| SKU: | 34060 |
| ISBN: | 1-935320-82-3 |
| Release Date: | 2009-11-09 |
| Duration: | 9.5 hrs / 101 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |