Flex/AS3 简单(我希望)拖放问题 - 防止拖动到其他控件
我搜索过但找不到答案,我相信对于有一点经验的人来说这很容易。我在一页上有多个数据网格,每个数据网格都可以通过拖放进行排序,但我不希望将项目药物从一个控件转移到另一个控件。如何防止用户将项目拖出控件。我希望它停止随鼠标移动,但如果需要,我准备完全取消拖动。
我试图做这样的事情
dragExit="dragEvent.CANCEL"
这显然是错误的,但我找不到正确的方法来做到这一点。
提前致谢。 ~迈克
I searched but couldn't find my answer, I'm sure it's easy for anyone with a little experience. I have multiple datagrids on a page, each one I want sortable with drag and drop, but I don't want items drug from one control to the other. How can I prevent a user from dragging an item out of a conrol. I would prefer to have it just stop moving with the mouse, but I am prepared to just completely cancel out of the dragging if need be.
I was trying to do something like this
dragExit="dragEvent.CANCEL"
This is obviously wrong, but I can't find the correct way to do it.
Thanks in advance.
~Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,所以您有一个具有多个拖放数据网格的应用程序,并且您只希望在数据网格内拖动项目,而不是从 1 拖动到另一个,这是我的理解。
您需要做的是为每个数据网格创建一个自定义
dragDrop
事件处理程序,其中包含以下命令:event.preventDefault()
。这实际上将阻止数据网格从另一个数据网格接收项目。这并不禁止将项目拖动到其主机边界之外,但会禁止将项目放入不同的数据网格中。
HTH。
Ok, so you have an app with multiple drag/drop datagrids, and you only want items dragged within a datagrid, and not from 1 to the other, is how I understand this.
What you need to do is create a custom
dragDrop
event handler for each datagrid which has the following command:event.preventDefault()
. This in effect will stop a datagrid from receiving items from another .This does not prohibit the dragging an item outside its host's borders, but it will prohibit the item being dropped into a different datagrid.
HTH.