使用 ActionScript 3 的触摸事件与鼠标单击事件
只是想问一下,在为手机或平板电脑(尤其是 iPhone)编写应用程序时,使用鼠标单击事件或触摸点击事件是否有任何优势?
我知道他们都应该工作得很好,但是就性能而言,谁更好?选择时有什么需要注意的吗?
顺便说一句,我使用 actionscript3 来实现该应用程序。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
很好的问题!点击事件“技术上”较慢,因为它们监视多个输入点。如果您只关心单点触摸输入,那么标准鼠标事件系统就可以了。对于触摸事件,每个侦听器都会创建几个对象,以帮助处理多点触摸功能(但这接近性能的微小分数毫秒损失)。
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).
我认为在平板电脑上实现应用程序时,touchEvent比mouseevent更好!我尝试了很多次!你可以测试一下
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
这可能是有关 Adobe AIR 触摸支持的最佳文档:
http://help.adobe.com/en_US/as3/dev/WSb2ba3b1aad8a27b0-6ffb37601221e58cc29-8000.html
该页面中途指出:
注意:监听触摸和手势事件可能会消耗大量处理资源(相当于每秒渲染几帧),具体取决于计算设备和操作系统。当您实际上不需要触摸或手势提供的额外功能时,通常最好使用鼠标事件。
我认为触摸的唯一好处是多点触摸。 TouchEvent 有一个 touchPointID,可让您跟踪每个触摸点的移动。如果您不关心多点触控,听起来鼠标事件将是最佳选择。
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.