Cicode Programming Reference > Cicode Function Categories > Display Functions Introduction > 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.

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"+AN:###);
! Displays AN nearest to the mouse.

See Also

Display Functions