Cicode Programming Reference > Cicode Function Categories > Display Functions > DspGetNearestAn

DspGetNearestAn

Gets the AN nearest to a specified x,y pixel location.

If using groups and the nearest object to the specified coordinates is part of a group, the AN of the object is returned, not the AN of the group.

If using clipping objects completely clipped ANs will be ignored when determining the nearest AN to the specified x, y pixel location. Partially clipped ANs are treated as being fully visible.

Syntax

DspGetNearestAn(X, Y)

X:

The x coordinate (in pixels).

Y:

The y coordinate (in pixels).

Return Value

The animation point number (AN). A value of -1 is returned if no AN is found.

Related Functions

DspGetMouse, DspAnGetPos, DspGetAnFromPoint

Example

DspGetMouse(X,Y);
! Gets mouse position.
AN=DspGetNearestAn(X,Y);
! Gets AN nearest to the mouse.
Prompt("Mouse At AN"+nAN:###);
! Displays AN nearest to the mouse.

See Also

Display Functions

Published June 2018