03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Parameters<br />

rect:Rectangle - The Rectangle object being checked.<br />

Returns<br />

Boolean - If the Rectangle object that you specify is contained by this Rectangle object,<br />

returns true; otherwise false.<br />

Example<br />

The following example creates four new Rectangle objects <strong>and</strong> determines whether rectangle<br />

A contains rectangle B, C, or D.<br />

import flash.geom.Rectangle;<br />

var rectA:Rectangle = new Rectangle(10, 10, 50, 50);<br />

var rectB:Rectangle = new Rectangle(10, 10, 50, 50);<br />

var rectC:Rectangle = new Rectangle(10, 10, 51, 51);<br />

var rectD:Rectangle = new Rectangle(15, 15, 45, 45);<br />

trace(rectA.containsRectangle(rectB)); // true<br />

trace(rectA.containsRectangle(rectC)); // false<br />

trace(rectA.containsRectangle(rectD)); // true<br />

equals (Rectangle.equals method)<br />

public equals(toCompare:Object) : Boolean<br />

Determines whether the object specified in the toCompare parameter is equal to this<br />

Rectangle object. This method compares the x, y, width, <strong>and</strong> height properties of an object<br />

against the same properties of this Rectangle object.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Parameters<br />

toCompare:Object - The rectangle to compare to this Rectangle object.<br />

Returns<br />

Boolean - If the object has exactly the same values for the x, y, width, <strong>and</strong> height properties<br />

as this Rectangle object, returns true; otherwise false.<br />

Rectangle (flash.geom.Rectangle) 1053

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!