Remove event listenner of a dragable object

Is there a way to remove an event listenner after releasing a dragable object?
 

I created an animation after the release, but the animation repeats when I catch the object after release

Thank you

You can remove it in the “ended” phase

I would normally have “ABC:removeEventListener(“tap”, onABCEvent )” to remove an event listenner, how would I emplamented an “ended” phase?

Since you are using “tap” then you won’t need to deal with phases.  You basically need to put the removeEventListener code at the end of the tap function.  Here is a simple example:

local circ = display.newCircle(20,20,20) local function onTap() -- First handle the tap with whatever you need here -- Then remove the event listener at the end circ:removeEventListener("tap", onTap) end circ:addEventListener("tap", onTap) 

–EDIT

However, after re-reading your original post, if you are creating a draggable object then you will not want to use the tap listener.  You will need the “touch” listener, which does use the phases.  So basically in the “ended” phase you would remove the touch listener.  If you are new to events and listeners be sure to check out the documentation as well as the tutorials.

I will try it out, thank you

You can remove it in the “ended” phase

I would normally have “ABC:removeEventListener(“tap”, onABCEvent )” to remove an event listenner, how would I emplamented an “ended” phase?

Since you are using “tap” then you won’t need to deal with phases.  You basically need to put the removeEventListener code at the end of the tap function.  Here is a simple example:

local circ = display.newCircle(20,20,20) local function onTap() -- First handle the tap with whatever you need here -- Then remove the event listener at the end circ:removeEventListener("tap", onTap) end circ:addEventListener("tap", onTap) 

–EDIT

However, after re-reading your original post, if you are creating a draggable object then you will not want to use the tap listener.  You will need the “touch” listener, which does use the phases.  So basically in the “ended” phase you would remove the touch listener.  If you are new to events and listeners be sure to check out the documentation as well as the tutorials.

I will try it out, thank you