Big Problem ... Ended phase on touch event not fired

hello developers

i have problem if i touch object (and still touch it without leave it ) began phase will be fired the problem is while i am touching my object and put another finger in another place in the screen the ended phase will not fired for my object so it will stick without executing ended phase code how can i prevent that from being ??
with respect …
[import]uid: 74537 topic_id: 19348 reply_id: 319348[/import]

It sounds like you do not have multi-touch enabled. This would mean that you will not get an end phase as long as you have at least one finger on the screen.

You can easily break single touch logic by doing exactly as you described i.e. touching the object with the attached event listener and then using a second finger to touch somewhere else on the screen usually a second object with a touch listener.

Try setting system.activate(“multitouch”) in your main.lua file [import]uid: 82631 topic_id: 19348 reply_id: 74700[/import]

Thanks @penhalion0 if activation of multitouch will fire the end phase for the first touched object its great solution for me if not i will looking for another work around to solve this issue

i will test it…

thanks in advance …
[import]uid: 74537 topic_id: 19348 reply_id: 74701[/import]

I’m curious what kind of overhead is involved, performance wise, of implementing multi-touch.

In the app I am working on, I don’t need it so I am not using it. But I just noticed that there is a certain part where I am also suffering from this glitch.

Including multitouch and ignoring any touch events with an id other than 1 seems like the only solution to eliminate this glitch, doesn’t it? [import]uid: 70391 topic_id: 19348 reply_id: 74715[/import]

thanks @green.castle
[import]uid: 74537 topic_id: 19348 reply_id: 74724[/import]

Don’t thank me, it was just a guess. I’m not sure if the event.id can be compared to 1 to get the id of the first finger, or if event.id is arbitrary. I posted this question in the documentation for event.id so there should be an answer fairly soon.

Also, is this behavior (second touch snuffs out the “ended” phase of the first in non-multitouch) inevitable, or is this a bug that Ansca will fix? It will *force* me to use multitouch, which, according to the documentation, is unreliable on some Androids. [import]uid: 70391 topic_id: 19348 reply_id: 74820[/import]

@green.castle i am sure its a bug from the SDK it should be like this ended phase fired when began ended or at the began phase of any new touches (in non - multitouch devices ) [import]uid: 74537 topic_id: 19348 reply_id: 74867[/import]

Have you checked if a “cancelled” event has been fired? [import]uid: 70847 topic_id: 19348 reply_id: 74929[/import]

No, but I will.

No, it does not. [import]uid: 70391 topic_id: 19348 reply_id: 75005[/import]

Bug report: http://developer.anscamobile.com/node/843/submission/3582 [import]uid: 70391 topic_id: 19348 reply_id: 74914[/import]

@ingemar no cancelled not fired also i am testing it on samsung galaxy s1 [import]uid: 74537 topic_id: 19348 reply_id: 75053[/import]

thank you @ingemar
i did not test it on real device that moved event will fired but i want solution to solve this problem without changing my code with big changes so if you have knowledge with deactivating multitouch after enable it i will appreciate that …

but i have an question can i get another touch coordinate with single touch in my stage ???

i am trying to handle another touch while the first finger is stationary on the screen without multitouch enable
[import]uid: 74537 topic_id: 19348 reply_id: 75070[/import]

Sorry, if you want to get the coordinates of the second touch you need multitouch enabled.
[import]uid: 70847 topic_id: 19348 reply_id: 75071[/import]

Wait a minute… multitouch *isn’t* activated, right?
I bet that you’ll get a “moved” phase on the first touch when the other object is touched with the second finger.

EDIT:
The problem with this is that there’s no way to distinguish between “moved” events from the first and second fingers.

I would say that if your uses are going to be using more than one finger to touch the screen, you must have multitouch enabled. [import]uid: 70847 topic_id: 19348 reply_id: 75067[/import]

but multitouch not supported in all android devices …

another problem enable multitouch causes problems with my game type if i can invoke the ended phase in single touch to begin with new touch event this will solve my problem
thank you again … [import]uid: 74537 topic_id: 19348 reply_id: 75072[/import]

No, that’s not the issue. The issue is that you can trick Corona into not firing the ‘ended’ phase for a non-multitouch app using multiple touches. See the bug report I did last night (above) [import]uid: 70391 topic_id: 19348 reply_id: 75098[/import]

I’m not really sure it’s a bug though.
If the app isn’t multitouch, it should ignore all other touches as long as the first touch is active.
Logically I think Corona is doing the right thing by not firing an ended event when the second touch is made.
The ended event will fire when you let the first touch go (even after the second touch).

I just wrote this simple code to test it myself. To me everything is working as it should.

[lua]local rect1Status = display.newText(“phase:”,200,100,native.systemFont,14);
local rect2Status = display.newText(“phase:”,200,250,native.systemFont,14);

local rect1 = display.newRect(50,50,100,100);
local rect2 = display.newRect(50,200,100,100);

local onTouch1 = function(event)
rect1Status.text = "phase: "…event.phase;
end

local onTouch2 = function(event)
rect2Status.text = "phase: "…event.phase;
end

rect1:addEventListener(“touch”, onTouch1);
rect2:addEventListener(“touch”, onTouch2);[/lua]

[import]uid: 70847 topic_id: 19348 reply_id: 75103[/import]

@ingemar - In your example, the listeners are on separate objects. In the workspace I uploaded ( http://developer.anscamobile.com/node/843/submission/3582 ), there is only one touch listener, it’s called on Runtime, and the first touch doesn’t end if you release it before the second touch is released.

I’m not sure if it would also be this way if the listener was on one display object. What happens if you touch one of those rectangles with two fingers?

I don’t see how a ‘began’ phase with no corresponding ‘ended’ phase can not be a bug. [import]uid: 70391 topic_id: 19348 reply_id: 75109[/import]

I agree with you that that would be a bug, but unfortunately it’s not possible for anyone else to look at your bug report you’re linking to. (It looks like Ansca isn’t giving others the permission to view it)

I’m still at a loss though.

I’ve changed my code to only have one listener on Runtime, and an “ended” event is fired whenever I release the first touch, regardless of how many times I’ve tapped with a second finger, or if the second finger is still touching when I let go of the first touch.

I must really be missing something here…

[lua]local rect1Status = display.newText(“phase:”,200,100,native.systemFont,14);
local rect2Status = display.newText(“phase:”,200,250,native.systemFont,14);

local rect1 = display.newRect(50,50,100,100);
local rect2 = display.newRect(50,200,100,100);

local onTouch1 = function(event)
rect1Status.text = "phase: "…event.phase;
end

Runtime:addEventListener(“touch”, onTouch1);[/lua]

[import]uid: 70847 topic_id: 19348 reply_id: 75114[/import]

By the way are we talking iOS or Android here?
I’ve been testing on iOS

Android has always been flaky regarding multitouch… [import]uid: 70847 topic_id: 19348 reply_id: 75120[/import]