flash 10.1 多点触摸:如何查找某个时间点的触摸次数?
我想知道用户当前是否使用多个手指在屏幕上绘图。 目前,TouchEvent 对象没有任何像 touchCounts 这样的属性,它告诉屏幕上的触摸次数。它只有一个 touchPointID,有助于识别特定的触摸。
我需要自己处理这个问题吗?例如:在 TOUCH_BEGIN 事件处理程序中,我可以看到我收到了多少个不同的唯一 touchPointID 并自己更新计数。
或者有更好的方法吗?
谢谢,
i want to find out if the user is currently using more than one finger to draw on the screen.
currently, the TouchEvent object doesn't have any property like touchCounts, which tells the number of touches on the screen. it just has a touchPointID, which helps to identify a particular touch.
do i need to handle this on my own ? for eg: in the TOUCH_BEGIN event handler i could see how many different unique touchPointID i have received and update the count myself.
or is there a better way ?
thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建一个对象来包含对每个触摸点的引用。只需创建一个对象,然后添加一个事件侦听器以在 TOUCH_BEGIN 上添加对该触摸点的引用。然后在 TOUCH_END 上从 Objrct 数组中删除该引用。然后,您可以随时询问对象 array.length 来获取任意给定时间的触摸计数。
查看此示例以了解如何执行此操作。它不完全是您正在寻找的东西,但非常接近并且可以轻松修改以获得您正在寻找的东西:
http://gotoandlearn.com/play.php?id=122
希望有帮助,祝你好运!
You could create an Object to contain references to each touch point. Simply create an Object, then add an event listener to add a reference to that touch point on TOUCH_BEGIN. Then on TOUCH_END remove that reference from the Objrct array. Then you can simply ask for the Objects array.length at any time to get the count for touches at any given time.
Review this example for how you might do this. It's not exactly what you're looking for but very close and easily could be modified to get what you're looking for:
http://gotoandlearn.com/play.php?id=122
Hope that helps, good luck!