Returns true if two objects overlap, false otherwise.

## Built-in Function handler[]

Syntax: intersect(<object(glossary)>, <object>[, <threshold> )

Examples:

intersect(field "Comment",the selectedField)

if intersect(button "target", button "crosshairs") then flashScreen

if intersect(graphic "spaceship", graphic "asteroid", "opaque pixels") then endGame

answer intersect(image "gradient", grc "solid",125)

Use the **intersect** function to determine whether one
object obscures part of another object, or
whether one object is over another object.

If both objects are stacks or cards, the **intersect**
function returns true if the stack
windows overlap.

The **intersect** function uses screen coordinates for stacks and
cards, and window coordinates for
controls. This means that if one object is
a stack or card and the other is a control, the
**intersect** function does not return a reliable result.

Parameters:

- object: an object reference.
- threshold (number 0-255 or enum): The amount of transparency that pixels in the objects must have in order to be counted during the intersect calculation. Alternative (readable) threshold options:
- "alpha value": An integer between 0 and 255 which specifies a threshold that the alpha value of each pixel must be greater than or equal to in order to be counted during calculation of the intersect.
- "bounds": (Equivalent to using an alpha value of 0) Specifies that the intersect is calculated using the rect of the two objects.
- "pixels": (Equivalent to using an alpha value of 1) Specifies that the intersect is calculated using pixels of the objects that have are not completely transparent, ignoring completely transparent areas.
- "opaque pixels": (Equivalent to using an alpha value of 255) Specifies that the intersect is calculated using only pixels that are completely opaque.

- Returns (bool):The
**intersect**function returns true or false.

## Notes[]

The intersect() command takes two objects as inputs. In some situations, it may be useful to find the intersect of a point and a rectangle. The custom function below may be used in those cases:

function pointIntersect pPoint,pRect split pPoint by comma split pRect by comma return ((pRect[1] <= pPoint[1]) and (pPoint[1] <= pRect[3]) and (pRect[2] <= pPoint[2]) and (pPoint[2] <= pRect[4])) end pointIntersect

Examples:

pointIntersect(the mouseLoc, the rectangle of stack "MyStack") pointIntersect(the clickLoc, the rect of img "Splash")

Use the pointIntersect function to determine whether a point is within a specified rectangle.

Parameters:
The pPoint is an expression that evaluates to a point.
The pRect is a rectangle consisting of four integers separated by commas.

Value: The pointIntersect function returns true or false.

Comments: The pointIntersect function does not differentiate between screen coordinates and window coordinations. This means that if the point is screen-relative, such as a mouseLoc, and the rectangle is window-relative, such as an object's rectangle, the pointIntersect function does not return a reliable result.

See also: within (function),stacks (function),card (object),stack (object),control (object),layer (property), move