多点触控和 Adobe AIR for Mobile
我正在使用 Adobe AIR 3.0 开发一款 Android 游戏,我也使用 Samsung Galaxy S2 来测试我的游戏,并且运行良好,帧速率达到 30 fps。
为了控制游戏,我使用虚拟操纵杆和屏幕上的一些按钮(例如投掷武器、跳跃等)。
然而,如果我按下一个按钮并同时按下另一个按钮,多点触控似乎无法正常工作。第一个停止工作。
这是定义多点触控行为的代码片段 -
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
对于跳跃按钮、虚拟操纵杆等 - 我正在使用 TouchEvent.TOUCH_BEGIN 事件。 请让我知道触摸事件出了什么问题。
I am developing a game for Android using Adobe AIR 3.0, also i am using Samsung Galaxy S2 to test my game, and is running pretty well with decent 30 fps.
to control the game-play, i am using virtual joystick and some button on screen (e.g. to throw weapon, jump etc).
however it seems that multitouch is not working fine, if i press one button and and in the same time if i down another button. first one stops working.
here is the code snippet which defines multitouch behavior -
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
for jump button, virtual joystick etc - i am using TouchEvent.TOUCH_BEGIN event.
please let me know what is wrong with touch event.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一般来说,每个触摸事件都会分配一个
touchPointID
,并且这个touchPointID
将通过它自己的TOUCH_BEGIN、TOUCH_MOVE和TOUCH_END保持一致。如果您最终根据错误的触摸点取消触摸事件,结果可能永远不会发生。请参阅 Adobe tuts 处理与touchPointID
。但是,您必须发布代码才能知道到底发生了什么。
In general, a
touchPointID
is assigned to every touch event, and thistouchPointID
will be consistent through it's own TOUCH_BEGIN, TOUCH_MOVE, and TOUCH_END. If you end up cancelling the touch event based on the wrong touch point, the results may never occur. See the Adobe tuts dealing withtouchPointID
.However, you will have to post your code to know what is really happening.
http://flex.org/tour-de-mobile-flex/ 值得退房。这对我很有帮助。
来自 MultiTouch.mxml:
http://flex.org/tour-de-mobile-flex/ is worth checking out. It has been helpful to me.
From the MultiTouch.mxml: