intersect

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
intersect(<object>, <object> [, <threshold>] )
Summary

Returns true if two objects overlap, false otherwise.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
object

an object reference.

threshold

The amount of transparency that pixels in the objects must have in order to be counted during the intersect calculation. Alternative (readable) theshold 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.
Example
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)
Values
NameTypeDescription
return

The intersect function returns true or false.

RelatedProperty: layer
Control Structure: function
Keyword: card, control
Constant: return
Object: card, stack
Glossary: control, relative coordinates, return, stack window, object
Function: within, stacks
Description

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 stackwindows 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.

Tagsui