Skip to main content
Inspiring
July 12, 2011
Question

Multi Touch not supported in Adobe Air for IOS?

  • July 12, 2011
  • 1 reply
  • 1457 views

Hi, I've just started developing my first app for my iPhone which is an iPhone 3GS. I'm using CS5 to make these apps.

I did a simple test game where there are two arrows on the screen and a fire button. The screen also has a ground and the player standing on it which can be controlled with left/right and fire. Now, if I press right, he moves right, if I press left, he moves left, if I press fire, he jumps... BUT no matter what I do I can't make dual touch work, ie: I press right AND fire, it only recognize just ONE touch point. So I did alot of researching and didn't find much.  I thought maybe adding a TouchEvent.TOUCH_TAP which I found a guide on on this page: http://openexhibits.org/support/gestures/1/one-finger-tap , but couldn't make it work, so I found this: http://www.adobe.com/devnet/flash/articles/multitouch_gestures.html and it seems Adobe Air for iPhone only allows four different gestures, no TouchEvents. I found a code somewhere that when run it checks to see if the device it's running on supports TOUCH_TAP stuff and in CS5 I got the message that it is not supported, in Adobe Device Central I get it's supported, on the actual phone (yes, got dev license from Apple and all that and can run my apps from CS5 on my iphone) I get it IS supported, but it doesn't work when I try it for real.

So, my question is: how can I make Adobe Air using CS5 to detect 2 finger presses at the same time in iPhone apps?  Like pressing right+fire at the same time, so it doesn't just detect ONE of them being pressed.

Thanks a million for any reply.


This topic has been closed for replies.

1 reply

July 13, 2011

Before listening for TouchEvents like TOUCH_BEGIN, TOUCH_MOVE, TOUCH_END etc... you need to set the input mode of your device to TOUCH_POINT. By default it is set to GESTURE.

This works fine on the iPAD:

import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;


// ...


Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

stage.addEventListener(TouchEvent.TOUCH_BEGIN, touchBegin);

stage.addEventListener(TouchEvent.TOUCH_MOVE, touchMove);
stage.addEventListener(TouchEvent.TOUCH_END, touchEnd);


private function touchBegin(te:TouchEvent):void {

    // your code here

}

private function touchMove(te:TouchEvent):void {

    // your code here

}

private function touchEnd(te:TouchEvent):void {

    // your code here

}

Hope that helps.

Participating Frequently
July 13, 2011

You can check out http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/ui/Multitouch.html for samples and documentation.

Thanks,

Sanika