Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Rectangle (flash.geom.Rectangle) > containsRectangle (Rectangle.containsRectangle method) | |||
public containsRectangle(rect:Rectangle) : Boolean
Determines whether the Rectangle object specified by the rect parameter is contained within this Rectangle object. A Rectangle object is said to contain another if the second Rectangle object falls entirely within the boundaries of the first.
Availability: ActionScript 1.0; Flash Player 8
rect:Rectangle - The Rectangle object being checked.
Boolean - If the Rectangle object that you specify is contained by this Rectangle object, returns true; otherwise false.
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
Flash CS3