I know I must be doing something silly but no matter what I try I can’t seem to get the function to only run once when the user enters the “ended” or “submitted” phase. I also experimented by completely removing them from the same line and doing if/ elseif/ end but I got the same results. Any input? Here’s the skeleton of my code:
[lua]local function objectFunction (event)
if ( “began” == event.phase) then
transition.to (object, {time = 1000, x = display.contentWidth/2 , y = display.contentHeight/2})
end
if ( “ended” == event.phase) or (“submitted” == event.phase) then
print (“ended or submitted”)
transition.to (object, {time = 1000, x = event.target.originalxLocation , y = event.target.originalyLocation})
native.setKeyboardFocus( nil )
end
end
object:addEventListener (“userInput”, objectFunction)[/lua]
Thanks in advance! [import]uid: 35535 topic_id: 33278 reply_id: 333278[/import]