Adobe AIR:触摸屏无法正确触发鼠标按下事件
我用 as3 设计了一个游戏亭应用程序 我在 Windows 7 的索尼 vaio l 电脑(如惠普的 touchsmarts)上使用它 该应用程序不需要任何多点触摸手势(仅单点触摸单击和拖动),因此我使用鼠标事件
一切都很好(包括鼠标单击和移动事件),除了对屏幕的单点触摸(不移动)不会不要按下鼠标。仅在手指
在应用程序外轻轻移动后才会触发,在我的桌面上,我看到小 Windows 7 光标立即跳转到手指放置的位置,这意味着这个问题不是硬件或 Windows 问题,而是Flash 应用程序如何在内部从操作系统接收“翻译的”触摸鼠标事件。
例如,在 Windows 纸牌游戏中,只需触摸屏幕即可立即突出显示所触摸的纸牌。 在我的应用程序中,只有当我触摸按钮并稍微移动手指时,按钮才会更改为按下状态(单击事件 - 向下和向上 - 都可以正常触发)
MOUSE_DOWN 事件的触发方式不应该与 TOUCH_BEGIN 中的 TOUCH_BEGIN 完全一样吗?新的触摸事件类?
有什么想法吗?
i have designed a gaming kiosk app in as3
i am using it on a Sony vaio l pc (like hp's touchsmarts) in windows 7
the app doesn't need any multi-touch gestures (only single touch clicks and drags) so i am using mouse events
everything is fine (including mouse click and move events) except that a single touch to the screen (with no move) doesn't fire a mouse down. it is fired only after a small move of the finger
outside the app, on my desktop, i see that the small windows 7 cursor jumps immediately to where a finger is placed, meaning this issue isn't a hardware or a windows problem but rather how internally the flash app receives "translated" touch-to-mouse events from the os.
for example, in a windows Solitaire game, a simple touch to the screen immediately highlights the touched card.
in my app, a button will change to the down state only if i touch it and also move my finger slightly (click events - down and up - are triggered fine)
shouldn't the MOUSE_DOWN event trigger exactly like how a TOUCH_BEGIN would in the new touchevent class?
any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题。
将
Multitouch.inputMode
属性设置为MultitouchInputMode.TOUCH_POINT
(默认值为MultitouchInputMode.GESTURE)
似乎会使MOUSE_DOWN
code> 事件在用户触摸屏幕时调度,而不是在触摸并移动或触摸并释放时调度。I encountered the same problem.
Setting the
Multitouch.inputMode
property toMultitouchInputMode.TOUCH_POINT
(the default value isMultitouchInputMode.GESTURE)
appears to make theMOUSE_DOWN
event dispatch when the user touches the screen and not when they touch and move or touch and release.如果光标在触摸时移动,那么我假设操作系统只是将其注册为 MOUSE_MOVE 而不是 MOUSE_DOWN。由于它是触摸屏,因此您可以将 MOUSE_MOVE 视为单击,因为用户可能实际上并未拖动手指来创建真正的 MOUSE_MOVE 事件。
好吧,如果他们实际上是在拖动手指进行操作,那么您可以假设 MOUSE_MOVE 突然将光标放在按钮上(没有先前的 MOUSE_MOVE,即拖动),它是 MOUSE_DOWN。
If the cursor moves when they touch, then I assume the OS is just registering this as a MOUSE_MOVE and not a MOUSE_DOWN. Since it's a touchscreen, you could just consider MOUSE_MOVE a click since the user probably isn't actually dragging their finger around creating a real MOUSE_MOVE event.
Well, if they are actually dragging their finger around for stuff then you could assume a MOUSE_MOVE that suddenly places the cursor on a button (with no prior MOUSE_MOVE i.e. dragging), it's a MOUSE_DOWN.
刚买了新的触摸屏,又遇到了这个问题。
因此,解决方案是通过在代码中的任意位置写入来将
Multitouch.inputMode
设置为MultitouchInputMode.TOUCH_POINT
:注意,测试时它不起作用通过
Ctrl+Enter
在 Flash 编辑器中(至少在 CC 2015 中)。因此,例如,您需要在 Flash Player 中单独打开.SWF
。编辑:但它确实可以在调试模式下工作! (
Ctrl+Shift+Enter
)Just bought a new touchscreen and encountered the problem again.
So the solution is to set
Multitouch.inputMode
toMultitouchInputMode.TOUCH_POINT
by writing anywhere in your code:Notice, that it does not work when testing by
Ctrl+Enter
in Flash Editor (at least in CC 2015). So, for example, you need to open.SWF
separately in Flash Player.EDIT: But it does work in Debug mode! (
Ctrl+Shift+Enter
)