Skip to main content
Inspiring
September 6, 2011
Question

Swipe and mouse events

  • September 6, 2011
  • 1 reply
  • 2855 views

Hi,

I try for an iOs application to reproduce the navigation of iOs photo gallery.

In iOs gallery, you can swipe quickly with your finger and the picture slide quickly in the same direction. But if your finger swipe slowly you can drag the picture, and when you release the finger the galleru change the picture or not if you move from half of screen width.

So for my code, i catch two type of events:

Swipe event and mouse events.

viewer.addEventListener(TransformGestureEvent.GESTURE_SWIPE, handleSwipe);

viewer.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);

viewer.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);

For the swipe, i do the same effect that iOS.

And for the Mouse, on mouse_down, i start a startdrag() of my viewer and stop it on mouse_up.

Debugging on my Macbook Pro with the trackpad works fine, with the three fingers, for swipe effect, and with mouse for the rest.

But on my device, it seems that swipe and mouse-down start at the same time ;(

Did i need to handle the swipe gesture manually with mouse direction ? (http://www.emanueleferonato.com/2010/07/05/detecting-mouse-gestures-in-flash-with-as3/)

Thanks by advance

Regards

This topic has been closed for replies.

1 reply

Vincent35Author
Inspiring
September 6, 2011

it seems there are not phase for swipe event

http://help.adobe.com/en_US/as3/dev/WS1ca064e08d7aa93023c59dfc1257b16a3d6-7ffd.html

The simple gestures swipe and two-finger tap do not track the event by multiple phases.

Vincent35Author
Inspiring
September 6, 2011

I have done a simple test by tracing the second and milliseconds between the two event.

Mouse_down always perform before swipe event, around 500ms.

I will investigate more the swipe event coding with mouse direction.