User Guide
Rectangle (flash.geom.Rectangle) 1039
Parameters
rect:flash.geom.Rectangle - The Rectangle object being checked.
Returns
Boolean - If the Rectangle object that you specify is contained by this Rectangle object,
returns
true; otherwise false.
Example
The following example creates four new Rectangle objects and determines whether rectangle
A contains rectangle B, C, or D.
import flash.geom.Rectangle;
var rectA:Rectangle = new Rectangle(10, 10, 50, 50);
var rectB:Rectangle = new Rectangle(10, 10, 50, 50);
var rectC:Rectangle = new Rectangle(10, 10, 51, 51);
var rectD:Rectangle = new Rectangle(15, 15, 45, 45);
trace(rectA.containsRectangle(rectB)); // true
trace(rectA.containsRectangle(rectC)); // false
trace(rectA.containsRectangle(rectD)); // true
equals (Rectangle.equals method)
public equals(toCompare:Object) : Boolean
Determines whether the object specified in the toCompare parameter is equal to this
Rectangle object. This method compares the
x, y, width, and height properties of an object
against the same properties of this Rectangle object.
Availability: ActionScript 1.0; Flash Player 8
Parameters
toCompare:Object - The rectangle to compare to this Rectangle object.
Returns
Boolean - If the object has exactly the same values for the x, y, width, and height properties
as this Rectangle object, returns
true; otherwise false.
Example
In the following example,
rect_1 and rect_2 are equal, but rect_3 is not equal to the other
two objects because its
x, y, width, and height properties are not equal to those of rect_1
and
rect_2.