within

returns true if a point is within an object, false if not.

# Metadata

Platforms: desktop, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:

# Syntax

within(object, point)

# Params

- object : Any object reference. - point : Any expression that evaluates to a point--a vertical and horizontal distance from the top left of the current stack, separated by a comma. (If the object is a stack, the distance is from the top left of the screen.)

# Examples

within(scrollbar ID 3,"33,40")

within(field "News Items",the clickLoc)

# Description

Use the within function to determine whether a point is inside the specified object.

If the point is within the clickable area of the object, the within function returns true, even if another object is layered on top of the object.

If the object is a graphic, its interior is considered to be within the graphic only if the graphic filled property is true or the graphic is selected.

If the object is an image, only pixels that contain paint are considered to be within the image. Transparent parts of the image are not within the image, although they are within the image rectangle.

If the object is a button whose menuMode is "tabbed", only the tabs are considered to be within the button. The area below the tabs is not within the button, although it is within the button rectangle.

If the object is a stack, the within function returns true if the point is in the stack content area, and false if the point is in the stack title bar or borders.

The expression

point is within the rect of object

is equivalent to

within(object, point)

unless the object a is a graphic or image, or a tabbed button.

# Tags

ui,

# See

- **property:** filled, menuMode, pixels, selected - **operator:** is not within, is within - **keyword:** button, image, rectangle, point, graphic - **object:** button, image, stack, graphic - **function:** intersect, mouseControl - **glossary:** property, return, title bar, object - **control structure:** function