Distance (Point.distance Method); Equals (Point.equals Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following example creates a copy of the Point object called
found in the
myPoint
, but it is not the same object.
myPoint
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
pt2:flash.geom.Point
Returns
- The distance between the first and second points.
Number
Example
The following example creates
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
1012
ActionScript classes
object. The
clonedPoint
- The first point.
- The second point.
and
point_1
).
clonedPoint
object contains all of the values from
, then determines the distance between
point_2
from the values

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