Copy link to clipboard
Copied
import flash.events.TouchEvent;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT;
stage.addEventListener(TouchEvent.TOUCH_BEGIN, mDown);
function mDown(e:TouchEvent):void
{
debugText.text = "TOUCH ID " + String(e.touchPointID);
}
This code on desktop works as expected (IDs are incrementing), but when I publish the app to my device (Lenovo IdeaTab A1000) it works like touch counter -1. (One finger = 0, two fingers 1 and so on....)
Does anyone know what to do with it?
Thank you
Copy link to clipboard
Copied
you only need to use touchPointID when handling touchbegin, touchend etc events and you need to check which touchpoint is triggering the touchbegin and touchend events.
Copy link to clipboard
Copied
Yes, that's what I am trying to do. But how can I do it if it does not track ID properly?
Copy link to clipboard
Copied
what makes you think it's not tracking properly?
Copy link to clipboard
Copied
Well because:
1) it works different in desktop simulation and on android device
2) every post on internet so far mentions that touchPointID is uniquie identifier - which is not
I am not sure you understand my question so I will put here some examples:
Example a)---------------------------------------------------
Desktop simulation:
10x tap with one finger - text field says "TOUCH ID 10"
Android device:
10x tap with one finger - text field says "TOUCH ID 0"
Example b)---------------------------------------------------
Desktop simulation:
Tap and hold with first finger, tap and hold with second finger - text field says "TOUCH ID 2"
>> Release both fingers >> tap with one finger - text field says "TOUCH ID 3"
Android device:
Tap and hold with first finger, tap and hold with second finger - text field says "TOUCH ID 1"
>> Release both fingers >> tap with one finger - text field says "TOUCH ID 0"
Copy link to clipboard
Copied
so?
do you see any problem with a touchbegin and touchend being confounded so the wrong object is associated with a touchend?
or what is the issue? are you trying to display a counter in a textfield that displays the number of times the screen is touched?
Copy link to clipboard
Copied
Well I was trying to fix the bug, if there is any.
I can adjust the script to this behavior and simply ignore desktop simulation if this is how it should work.
Thanks!
Copy link to clipboard
Copied
i don't see a problem. there's no need to use touchpointID unless you're using multitouch touchbegin/touchend events and you need to know which touchend goes with which touchbegin. in that situation i see no problem resetting all touchpoint ids when all touchend events have been dispatched.
Copy link to clipboard
Copied
I do use multitouch and I need to know which touch end when. This code is just a simple demonstration.
I will just go with it as a dogma - on desktop it's incrementing with every touch, on android it's unique identifier just for currently active touches.
I know how to remake that code to fit my needs (and ignoring desktop simulation). It just felt wierd that it acts differently on Android and I want to know why.
Copy link to clipboard
Copied
i don't know why it acts differently in your different test scenarios.
Copy link to clipboard
Copied
I am experiencing this as well, and it's incredibly frustrating. It's breaking my project.