Alright...I'll give you a brief introduction to what you are going to need. I have a link you can check out later if you want more detail...ready? Even if you are not...

Hopefully you remember something from trigonometry, in particular **the Unit Circle** and some **Trigonometric Identities**.

*Whats the unit circle?* A unit circle is simply a circle with a radius of one centered at the origin (0,0). You can find the position of any point on the circle by taking the sine and cosine of the angle which the point makes with the origin and the x-axis. Here is an ascii picture of part of a circle:

Code:

|- . P (x, y)
| / '
| / : < - - supposed to be a quarter of a circle
| / .
|/_t______|
t = angle with point P and x-axis

Usually "theta" is used instead of "t" but I didnt have enough room to put it.

Anyway...some trigonometry will tell us that we can find the position of point P by taking the sine and cosine of angle theta...something like this:

Code:

Px = cos (theta)
Py = sin (theta)

We can even take that further for *any* circle of a radius R:

Code:

Px = R * cos (theta)
Py = R * sin (theta)

Well with that said how about learning a few trigonometric identities? The ones that are going to help you with transformations are the **Sum Identities for Sine and Cosine**. Here is what they state:

Code:

cos (a + b) = cos a cos b - sin a sin b
sin (a + b) = sin a cos b + cos a sin b
"a" and "b" are both angles

*So what are those two equations saying?* That if you have an angle of "a" and add "b" to it you can find the sine and cosine of the sum with the above. *So?* Well, thats pretty much all 3d rotations are. You have a point that makes an angle of "a" with the x-axis and origin, and you rotate it by "b" degrees...if you are equiped with the two above equations you can find the sine and cosine of the rotate point (rotated by "b" degrees). *Still?...SO?* Now its time to tie back in with the unit circle. Remember that the sine and cosine of an angle **really** represents the ordered pair of a point. How about we substitue a few things in the above identities. Lets assume "a" is the angle the point makes with the x-axis and origin and that "b" is the increment rotation value...you could change the identities to something like this:

Code:

cos (a + b) = x * cos b - y * sin b
sin (a + b) = y * cos b + x * sin b
Remember that:
cos a = x
sin a = y

**But**, there is still even one more thing you can substitute. Look at the left side of the above equations...its basically the sine and cosine of an angle right (well, the sum of two angles but in the end its just one angle right?). We can now say that the sine and cosine of the sum of "a" and "b" equals the rotated point:

Code:

nx = x * cos b - y * sin b
ny = y * cos b + x * sin b

**That** right there is rotation in two dimensions or around the z-axis in particular. *How do you extrapolate that to the different axes?* Easy...just look at your graph from different sides. Your xy-axis graph becomes a zy-axis graph when looked at from the side. It becomes a xz-graph when looked at from the top. **So** in conclusion there are a total of six equations that rotate a point around all three axes:

Code:

// Given the ordered triplet of (x, y, z)
// and given the x, y, and z-axis rotation angles: a, b, c
// rotation around the x-axis
ry = y * cos a - z * sin a
rz = y * sin a + z * cos a
// rotation around the y-axis
rx = x * cos b - rz * sin b
rz = x * sin b + rz * cos b
// rotation around the z-axis
rx = rx * cos c - ry * sin c
ry = rx * sin c + ry * cos c
// your rotated ordered triplet is now (rx, ry, rz)

The above you can pretty much just copy and paste into Flash. And thats about it! If you wanted to add a throwing type action in you would obtain your "a" and "b" rotation angles (note: **no** "c" rotation angle because you cannot drag along the z-axis) by taking the difference of the mouse's x- and y-position when you are pressing the mouse button.

Cool eh? You can read more in depth articles here.

Good luck.