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

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The first example creates a Point object
with the default constructor.
point_1
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
with the coordinates x = 1 and y = 2.
point_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
- The length coordinate of the polar pair.
len:Number
- The angle, in radians, of the polar pair.
angle:Number
Returns
- The cartesian point.
flash.geom.Point
Example
The following example creates a Point object
from the value of
cartesianPoint
and a line length of 5. The
value equal to Math.atan(3/4)
angleInRadians
angleInRadians
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)
1016
ActionScript classes

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF