鼠标移动触发鼠标单击 (Adobe Air)
我试图在 SpriteVisualElement 上有两个客人,我认为这应该非常简单地实现:
用于扫描手势的 Mouse_Move 和鼠标单击以启用..
所以我的舞台上有 2 个事件侦听器:
stage.addEventListener(MouseEvent.CLICK, taphandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mousedownhandler);
主要问题是每种类型的扫描screen 还会触发 Taphandler()..
关于如何识别正确的事件有什么想法吗?
我尝试仅使用 if(!event.buttondown) 来处理我的 Taphandler,但没有成功。
I am trying to have two guestures on a SpriteVisualElement which I thought should be pretty simple implemented:
Mouse_Move for sweep Gestures and mouse click to enable..
So I have 2 Eventlisteners on my stage:
stage.addEventListener(MouseEvent.CLICK, taphandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mousedownhandler);
The main problem is that every type of sweeping on the screen also fires the taphandler()..
Any ideas on how to identify the correct event?
I tried to to my taphandler only if(!event.buttondown) but no success.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要专门处理MouseEvent.CLICK吗?或者您只是想分别处理点击和拖动。如果是这种情况,请尝试以下两种方法之一进行点击:(
请注意,这些事件处理程序位于您的精灵上,而不是舞台上)
对于触摸和拖动,请尝试:
您可能遇到的唯一问题是 TouchEvent.TOUCH_TAP和 TouchEvent.TOUCH_BEGIN 在您的设备上都可能被解释为 MouseClick.TOUCH,因此,如果您的精灵上附加了 MouseClick.TOUCH 的处理程序,则会发生冲突。
顺便说一句,大部分信息来自 Adobe Actionscript 3.0 参考 - TouchEvent
Do you need to handle MouseEvent.CLICK specifically? Or are you just trying to handle a tap and a drag separately. If this is the case, try one of these two for a tap:
(note that these event handlers are on your sprite, and not the stage)
For touch and drag, try:
The only issue you may run into is that TouchEvent.TOUCH_TAP and TouchEvent.TOUCH_BEGIN both might be interpreted as MouseClick.TOUCH on your device, so if you have a handler attached to your sprite for MouseClick.TOUCH, you will have a conflict.
BTW, most of this info is from the Adobe Actionscript 3.0 Reference - TouchEvent