EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Polar (Point.polar Method)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
1016 ActionScript classes
Example
The first example creates a Point object
point_1 with the default constructor.
import flash.geom.Point;
var point_1:Point = new Point();
trace(point_1.x); // 0
trace(point_1.y); // 0
The second example creates a Point object point_2 with the coordinates x = 1 and y = 2.
import flash.geom.Point;
var point_2:Point = new Point(1, 2);
trace(point_2.x); // 1
trace(point_2.y); // 2
polar (Point.polar method)
public static polar(len:Number, angle:Number) : Point
Converts a pair of polar coordinates to a cartesian point coordinate.
Availability: ActionScript 1.0; Flash Player 8
Parameters
len:Number - The length coordinate of the polar pair.
angle:Number - The angle, in radians, of the polar pair.
Returns
flash.geom.Point - The cartesian point.
Example
The following example creates a Point object
cartesianPoint from the value of
angleInRadians and a line length of 5. The angleInRadians value equal to Math.atan(3/4)
is used because of the characteristics of right triangles with sides that have ratios of 3:4:5.
import flash.geom.Point;
var len:Number = 5;
var angleInRadians:Number = Math.atan(3/4);
var cartesianPoint:Point = Point.polar(len, angleInRadians);
trace(cartesianPoint.toString()); // (x=4, y=3)

Table of Contents

Related product manuals