如何检测拖放操作已结束?

发布于 2024-08-20 03:16:43 字数 286 浏览 2 评论 0原文

这是参考我的其他问题

当拖放操作提前结束时,如何检测并分派事件? 我需要知道用户不再拖动项目。即使dragDrop 和dragComplete 事件不会触发。这几乎就像我需要向 DragManager 添加一个事件侦听器一样,但这实际上是不可能的......是吗?

This is in reference to My Other Question

How do can you detect and dispatch an event when a drag and drop operation ends prematurely?
I need to know that the user is no longer dragging an item. Even if the dragDrop and dragComplete events do no fire. Its almost as if I need to add an event listener to the dragManager, but that's not really possible... is it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

柏拉图鍀咏恒 2024-08-27 03:16:43

看起来基本上您需要能够判断 DragManager 是否崩溃。即使拖/放系统中存在错误事件(我没有见过,但也许我错过了一些明显的事情),您可能也不能总是指望它。

有点像试图设置一个客户端来知道服务器何时死亡之类的事情,是吗?

我可能离得很远,但我想你可以在开始拖动时添加一个 mouseMove 侦听器,并不断检查是否仍在拖动。我相信您可以动态设置 mouseMove 事件触发的频率。

当然,一旦您完成了拖动(无论是成熟还是过早),请删除 mouseMove 侦听器。

我真的并不热衷于做这样的事情。将保姆添加到操作中。但我认为它会做需要做的事情,而且我认为它不需要变得混乱。

It looks like basically you need to be able to tell if the DragManager craps out. Even if there was an ERROR event in the drag/drop system (there isn't that I've seen, but maybe I've missed something obvious), you probably couldn't always count on it.

Sort of like trying to set up a client to know when the server has died kind of thing, yeah?

I may be way off, but I'm thinking you could add a mouseMove listener when you begin your drag and constantly check to see if you are still dragging. I believe you can dynamically set how often that mouseMove event fires.

And, of course, once you complete the drag - whether maturely or prematurely - remove the mouseMove listener.

I'm really not crazy about doing something like this. Adding a babysitter to an operation. But I think it'd do what needs doing, and I don't think it needs to be messy.

时光礼记 2024-08-27 03:16:43

对于Flash Builder 4,尝试使用:

DragEvent.DRAG_EXIT

否则,您可以使用舞台事件监听器来监听鼠标移出

stage.addEventListener(MouseEvent.MOUSE_OUT...

For Flash Builder 4, try to use:

DragEvent.DRAG_EXIT

Otherwise, you can use a stage event listener to listen for mouse out

stage.addEventListener(MouseEvent.MOUSE_OUT...
祁梦 2024-08-27 03:16:43

监听拖动启动器的 dragComplete 事件类型。

Listen to dragComplete event type of drag initiator.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文