Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Point (flash.geom.Point) > distance (Point.distance method) | |||
Returns the distance between pt1 and pt2.
Availability: ActionScript 1.0; Flash Player 8
pt1:Point - The first point.
pt2:Point - The second point.
Number - The distance between the first and second points.
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