0

I want to enable 2-finger-pinch-zoom and 3-finger-drag in my app.

What is the easiest way to implement these basic multi-touch functions? No need for custom gestures, just the two multi-touch functions mentioned above:

2 fingers to zoom 3 fingers to pan.

Thanks! =)

Stian Berg Larsen
  • 543
  • 2
  • 10
  • 29

1 Answers1

1

Set the input mode to gesture, and then listen for the events: TransformGestureEvent.GesturePan and/or TransformGestureEvent.GestureZoom

JeffryHouser
  • 39,401
  • 4
  • 38
  • 59
  • Will this cause any problems with normal input like mouse and keyboard? Or does it simply add the function of multi-touch to an already working application.. This is to be used on both computers with keyboard/mouse and touch-screens.. – Stian Berg Larsen May 24 '12 at 12:50
  • @StianBergLarsen For Keyboard interaction it should make no difference. What device are you using that supports both Gestures and a mouse simultaneously? – JeffryHouser May 24 '12 at 12:52
  • I've tried adding the code for zooming, but I cant seem to get it working. Nothing happens. (No trace is shown). In my canvas I've added this: gestureZoom="videoBufferGZoom(event)" And the function sends a trace. But that doesnt happen. I've added this on creationComplete: Multitouch.inputMode=MultitouchInputMode.GESTURE; – Stian Berg Larsen May 24 '12 at 13:26
  • This is mainly for desktop use, not android or iOS at the moment.. If that has anything to say. – Stian Berg Larsen May 24 '12 at 13:33
  • @StianBergLarsen Does your hardware support Gestures? Check to see if gestures are supported: http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/ui/Multitouch.html#supportsGestureEvents – JeffryHouser May 24 '12 at 13:36
  • I'm using a SyncMaster LD220z monitor for gestures. Should have multi-touch support... – Stian Berg Larsen May 24 '12 at 13:41
  • The function returns true, so gestureEvents are possible.. Just not working :P hehe – Stian Berg Larsen May 24 '12 at 13:45
  • @StianBergLarsen I don't have any more advice for you. You could try alternate gestures libraries: http://gestureworks.com/features/open-source-gestures/ but I have no idea if you'll have better luck. – JeffryHouser May 24 '12 at 14:07
  • Today the gestures works. Might have been as simple as a restart that was needed :P Anyways, zoom gesture works, but it's far from smooth.. It's way too laggy. Even tried with a simple image in a new project, but still unusable because of the lag (200-800ms lagg). Any ideas? – Stian Berg Larsen May 25 '12 at 09:25
  • @StianBergLarsen Nope, no ideas. There are a lot of moving parts to something like this; and it could be anything including the hardware or the responsiveness of the AIR runtime, or the code. – JeffryHouser May 25 '12 at 12:48