02-22-2013 04:14 AM - edited 02-22-2013 04:14 AM
Hi,
So I need to have the user be able press 2 buttons/objects at the same time. It is a game controller: one to look around and one to walk around.
I know that we still (or at least could) can not check this through the emulator but I am using the tablet for debugging and I still can not get it working.
I have this line as the first line of my main:
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
And my buttons have these lines:
MyButton.addEventListener(TouchEvent.TOUCH_TAP, MyFunction);
The function is defined as:
private function MyFunction(event:TouchEvent):void
{
//Do something
}
Yet, I still can not press two of them at the same time. I must also add that there are also mouse-based buttons in the app. Any input is more than welcome.
02-22-2013 06:41 AM
I use multitouch in several of my apps, and it works fine. Though the only things I do are as following:
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
stage.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);
stage.addEventListener(TouchEvent.TOUCH_TAP, onTouchTap);
stage.addEventListener(TouchEvent.TOUCH_END, onTouchEnd);
I don't add the touchevent to specific elements, I add them to the stage (performance is ok, running in gpu mode)
In my event handler, I additionally need to read event.stageX and event.stageY to get the correct coordinates. Then I take my elements and check if they were in the touched zone(s)
02-22-2013 10:46 AM
Hmm never thought of adding event listener to the whole stage... I wonder if it makes the difference.
I also have TOUCH_BEGIN,TOUCH_MOVE, TOUCH_END and TOUCH_OUT they work as they should with a single finger...
02-26-2013 10:13 PM - edited 02-26-2013 10:14 PM
On the PlayBook I used them on Objects as well without an issue.
I saw a lot of good iOS tutorials on YouTube for AS3 + Multitouch that also work on QNX if you need some code examples.
Edit:. I used tbese when first starting on multitouch and PB.
02-27-2013 09:11 AM
03-07-2013 09:15 PM
After rewriting the app without objects I realized that I had written the code such that whenever a button is pressed the values that other buttons are sending become 0... So multitouch has been working..