View comments | RSS feed

Point (flash.geom.Point)


Object
    |
    +-flash.geom.Point

public class Point
extends Object

The Point class represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.

The following code creates a point at (0,0):

var myPoint:Point = new Point();

Availability: ActionScript 1.0; Flash Player 8

Property summary

Modifiers

Property

Description

 

length:Number

The length of the line segment from (0,0) to this point.

 

x:Number

The horizontal coordinate of the point.

 

y:Number

The vertical coordinate of the point.

Properties inherited from class Object

constructor, __proto__, prototype, __resolve


Constructor summary

Signature

Description

Point(x:Number, y:Number)

Creates a new point.

Method summary

Modifiers

Signature

Description

 

add(v:Point) : Point

Adds the coordinates of another point to the coordinates of this point to create a new point.

 

clone() : Point

Creates a copy of this Point object.

static

distance(pt1:Point, pt2:Point) : Number

Returns the distance between pt1 and pt2.

 

equals(toCompare:Object) : Boolean

Determines whether two points are equal.

static

interpolate(pt1:Point, pt2:Point, f:Number) : Point

Determines a point between two specified points.

 

normalize(length:Number) : Void

Scales the line segment between (0,0) and the current point to a set length.

 

offset(dx:Number, dy:Number) : Void

Offsets the Point object by the specified amount.

static

polar(len:Number, angle:Number) : Point

Converts a pair of polar coordinates to a Cartesian point coordinate.

 

subtract(v:Point) : Point

Subtracts the coordinates of another point from the coordinates of this point to create a new point.

 

toString() : String

Returns a string that contains the values of the x and y coordinates.

Methods inherited from class Object

addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch



Version 8

Comments


MoleMan said on Aug 14, 2006 at 7:02 AM :
The polar method provides nicely for polar->cartesian, but what about cartesian->polar? There doesn't seem to be an 'angle' property to go with 'length'.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002593.html