-
1. Re: Multitouch multiple touch points confusion
Colin Holgate Jul 31, 2013 5:03 PM (in response to xTLS)You’re using TOUCH_OUT. Might the press on the second button be seen as a touch out for the first button. What happens if you don’t use that listener?
-
2. Re: Multitouch multiple touch points confusion
Mark.fromOP Jul 31, 2013 11:14 PM (in response to Colin Holgate)Yeah what Colin said, insted of TOUCH_OUT use TOUCH_ROLL_OUT maybe?
-
3. Re: Multitouch multiple touch points confusion
xTLS Aug 1, 2013 11:56 AM (in response to Mark.fromOP)Thanks for the suggestion; I tried taking out the TOUCH_OUT event, but that doesn't make multitouch work, it merely prevents pressing the second button from releasing the first button.
Normally the SimpleButton changes to the DOWN state when you press it; you don't have to code anything to do this, merely provide images for the different states. Since only one SimpleButton will visually change state at a time, it seems like AIR isn't registering more than one touch point to begin with, rather than that there's a problem with my touch functions. The MultitouchInputMode doesn't get changed anywhere else so I really have no idea what's wrong unless there's something else I need to do to enable it that I'm not aware of
-
4. Re: Multitouch multiple touch points confusion
Mark.fromOP Aug 1, 2013 2:39 PM (in response to xTLS)I believe it has something to do with the fact you remove the listeners in your onHold function.
How about this
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
trace("supportsTouchEvents:" + Multitouch.supportsTouchEvents);
public function enableButtons():void {
button1.addEventListener(TouchEvent.TOUCH_BEGIN, onHoldButton, false, 0, true);
button1.addEventListener(TouchEvent.TOUCH_END, onReleaseButton, false, 0, true);
button1.addEventListener(TouchEvent.TOUCH_ROLL_OUT, onReleaseButton, false, 0, true);
button2.addEventListener(TouchEvent.TOUCH_BEGIN, onHoldButton, false, 0, true);
button2.addEventListener(TouchEvent.TOUCH_END, onReleaseButton, false, 0, true);
button2.addEventListener(TouchEvent.TOUCH_ROLL_OUT, onReleaseButton, false, 0, true);
}
private function onHoldButton(event:TouchEvent):void {
trace("HOLD BUTTON " + event.target.name);
var button:SimpleButton = event.currentTarget as SimpleButton;
//visual incidator
button.alpha = 0.5;
}
private function onReleaseButton(event:TouchEvent):void {
trace("RELEASE BUTTON" + event.target.name);
var button:SimpleButton = event.currentTarget as SimpleButton;
//visual incidator
button.alpha = 1;
}
-
5. Re: Multitouch multiple touch points confusion
xTLS Aug 1, 2013 5:54 PM (in response to Mark.fromOP)That's standard practice though, isn't it? I do that for all of my mouse events to minimize the number of events running at once. Unless the touch events work completely differently and are completely broken, my code is only removing the event from the button that was just pressed (event.target won't affect the other button)
Ignore my code completely. I have two simple buttons, and Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT. A SimpleButton should visually change when you press it, this is built into the SimpleButton. However, only one button is changing color at a time, even when I press both of them. Does this mean Multitouch isn't running at all?
The same problem is occuring on a Transformer Infinity so it must not be a flaw with the Galaxy Tab. The Zoom gesture works fine, for what that's worth. I'm using AIR 3.7, I'll try a different version of AIR tomorrow.
-
6. Re: Multitouch multiple touch points confusion
Mark.fromOP Aug 1, 2013 7:19 PM (in response to xTLS)With mouse events you never have to worry about multiple clicks at once since you only have the one mouse. I can assure you can press more than one button at a time up to 11 on an iPad I believe. I have multi touch apps that allow the user to click something while already engaged in something. I honestly never use SimpleButtons, the button class works poorly with touch events. I recall my first app I had a flash button vs a code it yourself button and it killed performance by now that has probably been fixed but I have long ditched button symbols in favor of my own AS + MC versions.
I would recommend working step by step before simplifying, first proof of concept, two buttons two listeners and even two separate functions, once you get that to work correctly start combining, have them share a function, then have them share a listener but always start from a working solution.
Beware some android devices only support two touch points, keep all fingers clear of the screen when testing.
-
7. Re: Multitouch multiple touch points confusion
xTLS Aug 2, 2013 11:21 AM (in response to Mark.fromOP)"With mouse events you never have to worry about multiple clicks at once since you only have the one mouse. "
I know, I'm just saying the code
var button:SimpleButton = event.currentTarget as SimpleButton;
button.removeEventListener(TouchEvent.TOUCH_BEGIN, onHoldButton);
will not prevent the events from working correctly, as the TOUCH_BEGIN event is only removed from the button that is already touched, not affecting the button that wasn't touched yet.
Here's the answer: SimpleButton does NOT support Multitouch. I changed the buttons to a custom class and the problem went away. I usually do code my own components rather than using Adobe's components, and I've even done my own two-state buttons in the past, but for this project I had assumed SimpleButton would be adequate. Apparently not!
Thank you for your assistance, I probably would have wasted more hours before trying a different button class if you hadn't said SimpleButton works poorly with touch events. Would you like to add the note that SimpleButton does not support Multitouch to your post so anyone else who has this problem will see the answer more easily?
Should a bug report be filed about SimpleButton not supporting Multitouch?
-
8. Re: Multitouch multiple touch points confusion
Mark.fromOP Aug 2, 2013 7:50 PM (in response to xTLS)Cant seem to edit my post, so here is the short of it based on your discoveries.
Here's the answer: SimpleButton does NOT support Multitouch.
You can mark this or your own reply as correct.



