Canvas and Stage Settings

Is there away to figure out when the user lifts his/her hand from the canvas. I am trying to build an app where a sprite automatically goes to a user’s finger when they touch the canvas, and follows the users fingers. I need a way for the canvas to detect when the user lifts his or her finger any suggestions on how to do this?


1 Like

actech I did try that block but it doesn’t work since I’m not really dragging the sprite. I am having the sprite move to where my finger is on the canvas. I need to be able to have the sprite hide when I stop dragging my finger on the canvas if that makes since.

In this case, the problem can be solved as follows. When you click on the canvas, a timer is activated to track changes in the finger’s coordinate. If the coordinate does not change during the specified time interval, it means that the finger has been removed from the screen and you can move the sprite and turn off the change tracking timer.

1 Like

Can you set an IF condition of: IF the Sprite X & Y = the Pointer X & Y then Hide?

Seth I have tried that but that doesn’t work also.

1 Like

acetech I tried the timer to see if that would work but, still no luck thanks for the idea!

If you use a loop forever, it will follow the pointer.

You want it to go after the user lifts their finger, right?

Going back to what actech said, you can then compare the X&Y of the last pointer position and if it has been that for x time then you can delete it.

It may be incorrect to put the X to X check there, I’m still testing really. But do you see the direction of my thinking?

Seth I don’t understand the does timer milliseconds contain 5, at some point that would be true, Also at some since we want the sprites active x to go to the canvas active point that would also be true so it would constantly be removing the sprite. Unless I’m totally not understanding your code.

I’m not sure if my code will work for your application, but maybe it can be an inspiration.

Is there any compromise?

Check it


Thanks for the help I will check out your code. Right now I am using the canvas drag, and have the sprite bounce of the edges of the screen.

I appreciate the help!

Thanks, I felt I was close but I don’t have a lot of spare time these days.

If you find a way to almost do it please post and I’ll be happy to have a look.

1 Like