Cursor collision

Is there any code for the cursor when it hits a certain object?

You wanna check when a cursor touches a certain object?
In that case, you can either use the mouse hover script, or this line of code:

clip._mouseState // replace "clip" with the name of clip

The code above will be equal to "over" (string) if the mouse was over the clip, it will also be equal to "down" if the cursor is clicked down on the clip, and "out" if the cursor is outside of the clip. So, if you want to use it to see if a cursor is hitting a certain object, then check to see if it’s not equal to "out".

if(clip._mouseState !== "out"){
// code here
1 Like

Thanks man, Everything i tried was a fail, much obliged.

1 Like