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

Parameters

rect: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

Flash CS3


 

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

Current page: http://livedocs.adobe.com/flash/9.0/main/00002081.html