Hi
What I want to do in my app is on tap of an object transition it to the centre of the screen and then when its tapped again remove it. I have an eventlistener on the object which calls a function to reposition it and then inside that function I have a removeEventListener and another addEventListener to call another function to transition the object back off the screen. I thought this would work but instead on tap of the object is running both functions at once.
How do I get it to just call one function until I tap on it again. Heres the two functions:
touchPhoto = function ( event ) timer.pause( timer1 ) timer.pause( timer2 ) tapId = event.target.id print(tapId.."one") photosTable[tapId]:removeEventListener( "tap", touchPhoto ) transition.to( photosTable[tapId], {rotation = 360, width =200, height = 200, x= centerX, y = centerY} ) physics.removeBody(photosTable[tapId]) photosTable[tapId]:toFront() photosTable[tapId]:addEventListener( "tap", anotherTouch ) end anotherTouch = function ( event ) timer.resume( timer1 ) timer.resume( timer2 ) tapId = event.target.id print(tapId.."two") transition.to( photosTable[tapId], {rotation = 0, width =200, height = 200, x= centerX+1000, y = centerY+1000} ) end