touch events vs mouse click events using actionscript 3
Asked Answered
M

3

10

Just wanted to ask if there is any advantage for either using mouse click event or touch tap events, when writing apps for mobiles or tablets (for the iphone especially)?

I know that both of them should work fine, but in term of performance, is anyone better? Are there any things I should be aware of when choosing either?

By the way am using actionscript3 to implement the app.

Motteo answered 11/1, 2012 at 19:10 Comment(0)
L
9

This is probably the best documentation on Adobe AIR touch support:

http://help.adobe.com/en_US/as3/dev/WSb2ba3b1aad8a27b0-6ffb37601221e58cc29-8000.html

Midway through that page it states:

Note: Listening for touch and gesture events can consume a significant amount of processing resources (equivalent to rendering several frames per second), depending on the computing device and operating system. It is often better to use mouse events when you do not actually need the extra functionality provided by touch or gestures.

The only benefit of touch, I would think, would be multi-touch. The TouchEvent has a touchPointID which allows you to track the movement of each touch point. If you don't care about multi-touch, it sounds like Mouse Events would be the way to go.

Lanctot answered 11/1, 2012 at 19:26 Comment(2)
can an AIR app use both Touch and Mouse events within various classes? It doesnt appear so.Blackstock
I believe you can add both TouchEvent and MouseEvent listeners at the same time. Here's a related question that seems to concur: #11769894Lanctot
M
2

Excellent question! Tap events are "technically" slower as they monitor multiple input points. If your only concerned with a single touch input, the standard mouse event system is just fine. For touch events, there's a couple objects being created per listener to assist in handling the multitouch functionality (however this is close to a tiny fractional ms loss in performance).

Maines answered 11/1, 2012 at 19:23 Comment(0)
P
0

i think that the touchEvent is better than mouseevent when implement the app on tablets!i try it many times!you can have a test

Preraphaelite answered 15/1, 2014 at 3:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.