contains (Rectangle.contains method)

public contains(x:Number, y:Number) : Boolean

Determines whether the specified point is contained within the rectangular region defined by this Rectangle object.

Availability: ActionScript 1.0; Flash Player 8

Parameters

x:Number - The x-value (horizontal position) of the point.

y:Number - The y-value (vertical position) of the point.

Returns

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

Example

The following example creates a Rectangle object and tests whether each of three coordinate pairs falls within its boundaries.

import flash.geom.Rectangle;

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

See also

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/00002622.html