Double click event?

Hello,

Is there any way to create a double click event? I only saw the “touch” event.
Thanks! [import]uid: 28830 topic_id: 6480 reply_id: 306480[/import]

The Tap event has a numTaps property that you could use, like this:

[code]
local onTap = function(event)

if 2 == event.numTaps then
makeItFly()
end

end

Runtime:addEventListener(“tap”, onTap)
[/code] [import]uid: 5833 topic_id: 6480 reply_id: 22455[/import]

I have just tested the “tap” event. On double clicking, it triggers the event twice, first with numTaps == 1, and then with numTaps == 2.

When numTaps == 1 I do not know if it was a single click or if it comes a double click.

This is not the expected behavior for the doubleclick event, or at least I didn’t figure out how to implement it :frowning:
[import]uid: 28830 topic_id: 6480 reply_id: 22534[/import]

It first gets fired with a single tap as it is not a “doubletap” event, it is simply a “tap” event so will get fired with 5 taps as well.

What you need to do is check if there are 2 taps and then perform your function then.

There doesn’t seem to be any more control over it then that. You could also check the time between the taps to get a bit of control over the double tap speed. [import]uid: 5833 topic_id: 6480 reply_id: 22544[/import]

@GrahamRanson Do you know what the recommended Apple time to wait after the first tap for the second is, before reporting it as a double tap? I can’t seem to find any reference on the net or Apple’s dev site.

matt [import]uid: 8271 topic_id: 6480 reply_id: 25955[/import]

I haven’t found anything official however this post recommends/uses 350ms - http://www.cimgf.com/2010/06/14/differentiating-tap-counts-on-ios/ - and this one uses 500 ms - http://iphonedevelopertips.com/cocoa/single-double-and-triple-taps.html [import]uid: 5833 topic_id: 6480 reply_id: 25957[/import]