I know this is a scary word for some, but it is not all that scary. Math is a built in function that acts like a calculator.
//this takes the square root of the number in the parenthesis
//Finds random number between zero and the number after *
//Rounds the number in the parenthesis
//Rounds the number in the parenthesis to higher integer
//Rounds the number in the parenthesis to lower integer
Lets look at how ‘Math.random()*’ works:
//Simply picks a random number between 0 and 6
Math.abs() an absolute value.
Math.acos() an arc cosine.
Math.asin() an arc sine.
Math.atan() an arc tangent.
Math.atan2() an angle from the x axis to the point. Math.ceil() a number up to the nearest integer. Math.cos() a cosine.
Math.exp() an exponential value.
Math.floor() a number down to the nearest integer. Math.log() a natural logarithm.
Math.max() the larger of the two integers. Math.min() the smaller of the two integers.
Math.pow() to the power of the . Math.random() a pseudo-random number between 0.0 and 1.0.
Math.round() to the nearest integer.
Math.sin() a sine.
Math.sqrt() a square root.
Math.tan() a tangent.
I made this next example from my new knowledge of ActionScript:
var arrow=element ("arr");
//this script makes ‘arrow’ point to wherever the mouse is.
I used this small little script to make an I-pod dial, the one that goes through the menu when you move your finger around it, except it follows the mouse movement. I don’t like long complicated code, especially when the same effect can be achieved with short simple code. You just have to have the idea set.