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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

clone (Point.clone method)<br />

public clone() : Point<br />

Creates a copy of this Point object.<br />

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

Returns<br />

Point - The new Point object.<br />

Example<br />

The following example creates a copy of the Point object called clonedPoint from the values<br />

found in the myPoint object. The clonedPoint object contains all of the values from<br />

myPoint, but it is not the same object.<br />

import flash.geom.Point;<br />

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

var clonedPoint:Point = myPoint.clone();<br />

trace(clonedPoint.x); // 1<br />

trace(clonedPoint.y); // 2<br />

trace(myPoint.equals(clonedPoint)); // true<br />

trace(myPoint === clonedPoint); // false<br />

distance (Point.distance method)<br />

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

Returns the distance between pt1 <strong>and</strong> pt2.<br />

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

Parameters<br />

pt1:Point - The first point.<br />

pt2:Point - The second point.<br />

Returns<br />

Number - The distance between the first <strong>and</strong> second points.<br />

Example<br />

The following example creates point_1 <strong>and</strong> point_2, then determines the distance between<br />

them (distanceBetween).<br />

import flash.geom.Point;<br />

1026 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!