Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Rectangle (flash.geom.Rectangle) > 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
pt:Point - The point, as represented by its x,y values.
Boolean - If the specified point is contained within this Rectangle object, returns true; otherwise false.
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
contains (Rectangle.contains method), Point (flash.geom.Point)
Flash CS3