03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

var point_1:Point = new Point(-5, 0);<br />

var point_2:Point = new Point(5, 0);<br />

var distanceBetween:Number = Point.distance(point_1, point_2);<br />

trace(distanceBetween); // 10<br />

equals (Point.equals method)<br />

public equals(toCompare:Object) : Boolean<br />

Determines whether two points are equal. Two points are equal if they have the same x <strong>and</strong> y<br />

values.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Parameters<br />

toCompare:Object - The point to be compared.<br />

Returns<br />

Boolean - If the object is equal to this Point object, true; if it is not equal, false.<br />

Example<br />

The following example determines whether the values of one point are equal to the values of<br />

another point. If the objects are the same, equals() does not return the same result that the<br />

strict equality operator (===) does.<br />

import flash.geom.Point;<br />

var point_1:Point = new Point(1, 2);<br />

var point_2:Point = new Point(1, 2);<br />

var point_3:Point = new Point(4, 8);<br />

trace(point_1.equals(point_2)); // true<br />

trace(point_1.equals(point_3)); // false<br />

trace(point_1 === point_2); // false<br />

trace(point_1 === point_3); // false<br />

interpolate (Point.interpolate method)<br />

public static interpolate(pt1:Point, pt2:Point, f:Number) : Point<br />

Determines a point between two specified points. The parameter f determines where the new<br />

interpolated point is located relative to the two end points specified by parameters pt1 <strong>and</strong><br />

pt2. The closer parameter f is to 1.0, the closer the interpolated point will be to the first<br />

point (parameter pt1). The closer parameter f is to 0, the closer the interpolated point will be<br />

to the second point (parameter pt2).<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Point (flash.geom.Point) 1027

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!