开发者

flash 10.1 multi-touch: how to find the number of touches at a point in time?

开发者 https://www.devze.com 2023-01-29 00:30 出处:网络
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 to

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 a开发者_如何学编程nd update the count myself.

or is there a better way ?

thanks,


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消