<A HREF="/Tech" TARGET="_self"><IMG SRC="FT-Logo.gif" WIDTH=137 HEIGHT=70 BORDER=0></A>
Plug & Play - Trig Functions

We have two Plug & Play Trig movie clips (MCs). They both work the same but one just includes the sine and cosine functions whereas the other has all 6 of the standard trigonometry functions. The Sine & Cosine MC (3K) is found in the Sine-Cosine MC layer; it is a guide layer because it is not used in the demo. The TrigAll MC (4.2K) with all six trig functions is in the TrigAll MC layer. Copy the needed MC to the main timeline of your FLA. Make sure the Movie Clip is available from the place you will Call it. Normally it is best to put it in a layer of its own so it will always be available.

These functions will work with any angle value (in degrees up to 11 digits long) including negative values and values above 360. Angles are rounded and not truncated to the nearest degree before processing. Tangent, cotangent, secant and cosecant will return an infinite number for some angles and Flash will return an error (#ERROR#) for these infinite numbers and for any division by zero. In frame 1 of the Trig (TrigAll) MC there is a setting for 'Infinity' which is preset to 999999999 to provide a numeric value for infinity instead of the string error message. You can change this to any value you desire.

Trig Functions: 

   Sine         sin
   Cosine       cos
   Tangent      tan
   Cotangent    cot
   Secant       sec
   Cosecant     csc

<A HREF="/Tech" TARGET="_self"><IMG SRC="FT-Logo.gif" WIDTH=137 HEIGHT=70 BORDER=0></A>
Download FLA in Zip format
Using the Routines
If your variable is already named Angle then all you have to do is Call the appropriate function below: The result of the function will be returned in the variable Answer.
     Call ("/Trig:sin")
     Call ("/Trig:cos")
     Call ("/Trig:tan")
     Call ("/Trig:cot")
     Call ("/Trig:sec")
     Call ("/Trig:csc")
If your input variable is not named Angle then you will need to set Angle to be equal to your variable before the Call. Also, if the variable you will use with the result is not 'Answer' then following the Call you will need to set your variable to equal Answer. In the statement below substitute the name of your output variable for 'YourVarNameOut'.
Set Variable: "Angle" = YourVarNameIn
  Call ("/Trig:sin")
Set Variable: "YourVarNameOut" = Answer