I’m just learning Corona at the moment and having trouble with something very basic and unfortunately haven’t been able to find the answer when doing a search. Basically I’ve got a circle on the screen that registers a touch event. When I exit the circle it doesn’t leave the touch event. I did a search an found out I need to set the focus to the object so the event is limited to that object, but still when I leave the object it’s not ending the touch event. Here is the code I have:-
local outterCircle = display.newCircle( 200, 180, 30,10 )
local function listener(event)
if event.phase == "began" then
event.target.isFocus = true
print ("focused")
else
if event.phase == "ended" or event.phase == "cancelled" then
event.target.isFocus = false
print ("un-focused")
end
end
end
outterCircle:addEventListener("touch", listener)
If my touch leaves the object I’d like it to end there, but right now it stays active. This is something I’d probably use for controls on the screen, or buttons, or similar things.
If anyone can point me in the right direction it would be greatly appreciated! [import]uid: 133056 topic_id: 23064 reply_id: 323064[/import]
