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:Point - The first point.

pt2: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

Flash CS3