Rectangle (flash.geom.Rectangle) 1043
intersection (Rectangle.intersection method)
public intersection(toIntersect:Rectangle) : Rectangle
If the Rectangle object specified in the
toIntersect
parameter intersects with this Rectangle
object, the
intersection()
method returns the area of intersection as a Rectangle object. If
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
toIntersect
:flash.geom.Rectangle
- The Rectangle object to compare against to see if it
intersects with this Rectangle object.
Returns
flash.geom.Rectangle
- A Rectangle object that equals the area of intersection. If the
rectangles do not intersect, this method returns an empty Rectangle object; that is, a rectangle
with its
x
,
y
,
width
, and
height
properties set to 0.
Example
The following example determines the area where
rect_1
intersects
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
toIntersect
parameter intersects with this
Rectangle object. This method checks the
x
,
y
,
width
, and
height
properties of the specified
Rectangle object to see if it intersects with this Rectangle object.
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...