containsPoint (Rectangle.containsPoint method)

public containsPoint(pt:Point) : Boolean

Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. This method is similar to the Rectangle.contains() method, except that it takes a Point object as a parameter.

Availability: ActionScript 1.0; Flash Player 8

Parameters

pt:flash.geom.Point - The point, as represented by its x,y values.

Returns

Boolean - If the specified point is contained within this Rectangle object, returns true; otherwise false.

Example

The following example creates a Rectangle object and three Point objects, and tests whether each of the points falls within the boundaries of the rectangle.

import flash.geom.Rectangle;
import flash.geom.Point;

var rect:Rectangle = new Rectangle(10, 10, 50, 50);
trace(rect.containsPoint(new Point(10, 10))); // true
trace(rect.containsPoint(new Point(59, 59))); // true
trace(rect.containsPoint(new Point(60, 60))); // false

See also

contains (Rectangle.contains method), Point (flash.geom.Point)


Version 8

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002623.html