intersection (Rectangle.intersection method)
public intersection(toIntersect:Rectangle) : Rectangle
If the Rectangle object specified in the
parameter intersects with this Rectangle
toIntersect
object, the
method returns the area of intersection as a Rectangle object. If
intersection()
the rectangles do not intersect, this method returns an empty Rectangle object with its
properties set to 0.
Availability: ActionScript 1.0; Flash Player 8
Parameters
- The Rectangle object to compare against to see if it
toIntersect:flash.geom.Rectangle
intersects with this Rectangle object.
Returns
- A Rectangle object that equals the area of intersection. If the
flash.geom.Rectangle
rectangles do not intersect, this method returns an empty Rectangle object; that is, a rectangle
with its
,
,
, and
properties set to 0.
x
y
width
height
Example
The following example determines the area where
intersects
.
rect_1
rect_2
import flash.geom.Rectangle;
var rect_1:Rectangle = new Rectangle(0, 0, 50, 50);
var rect_2:Rectangle = new Rectangle(25, 25, 100, 100);
var intersectingArea:Rectangle = rect_1.intersection(rect_2);
trace(intersectingArea.toString()); // (x=25, y=25, w=25, h=25)
intersects (Rectangle.intersects method)
public intersects(toIntersect:Rectangle) : Boolean
Determines whether the object specified in the
parameter intersects with this
toIntersect
Rectangle object. This method checks the
,
,
, and
properties of the specified
x
y
width
height
Rectangle object to see if it intersects with this Rectangle object.
Rectangle (flash.geom.Rectangle)
1043
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?