var line_mc:MovieClip =
canvas_mc.createEmptyMovieClip("line"+nextDepth+"_mc", nextDepth);
line_mc.moveTo(this.origX, this.origY);
line_mc.lineStyle(2, 0x000000, 100);
line_mc.lineTo(this.newX, this.newY);
var hypLen:Number = Math.sqrt(Math.pow(line_mc._width,
2)+Math.pow(line_mc._height, 2));
line_mc.createTextField("length"+nextDepth+"_txt",
canvas_mc.getNextHighestDepth(), this.origX, this.origY-22, 100, 22);
line_mc['length'+nextDepth+'_txt'].text = Math.round(hypLen) +" pixels";
};
Mouse.addListener(mouseListener);
Math.SQRT1_2
Availability
Flash Player 5. In Flash Player 4, the methods and properties of the Math class are emulated using
approximations and might not be as accurate as the non-emulated math functions that Flash
Player 5 supports.
Usage
Math.SQRT1_2:Number
Description
Constant; a mathematical constant for the square root of one-half, with an approximate value of
0.7071067811865476.
Example
This example traces the value of
trace(Math.SQRT1_2);
// Output: 0.707106781186548
Math.SQRT2
Availability
Flash Player 5. In Flash Player 4, the methods and properties of the Math class are emulated using
approximations and might not be as accurate as the non-emulated math functions that Flash
Player 5 supports.
Usage
Math.SQRT2
Description
Constant; a mathematical constant for the square root of 2, with an approximate value of
1.4142135623730951.
Example
This example traces the value of
360
Chapter 6: ActionScript Core Classes
Math.SQRT1_2.
Math.SQRT2.
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?