User Guide
1012 ActionScript classes
Example
The following example creates a copy of the Point object called
clonedPoint from the values
found in the
myPoint object. The clonedPoint object contains all of the values from
myPoint, but it is not the same object.
import flash.geom.Point;
var myPoint:Point = new Point(1, 2);
var clonedPoint:Point = myPoint.clone();
trace(clonedPoint.x); // 1
trace(clonedPoint.y); // 2
trace(myPoint.equals(clonedPoint)); // true
trace(myPoint === clonedPoint); // false
distance (Point.distance method)
public static distance(pt1:Point, pt2:Point) : Number
Returns the distance between pt1 and pt2.
Availability: ActionScript 1.0; Flash Player 8
Parameters
pt1:flash.geom.Point - The first point.
pt2:flash.geom.Point - The second point.
Returns
Number - The distance between the first and second points.
Example
The following example creates
point_1 and point_2, then determines the distance between
them (
distanceBetween).
import flash.geom.Point;
var point_1:Point = new Point(-5, 0);
var point_2:Point = new Point(5, 0);
var distanceBetween:Number = Point.distance(point_1, point_2);
trace(distanceBetween); // 10
equals (Point.equals method)
public equals(toCompare:Object) : Boolean
Determines whether two points are equal. Two points are equal if they have the same x and y
values.
Availability: ActionScript 1.0; Flash Player 8