Flex DRAG_DROP 事件 - 是否可以访问被拖动的图像? [英] Flex DRAG_DROP Event - Is it possible to access the Image Being Dragged?

查看:17
本文介绍了Flex DRAG_DROP 事件 - 是否可以访问被拖动的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您启动 Flex 拖动操作时,您会传入一个代理图像,以便在您在屏幕上拖动时显示.发生放置时,我希望能够获取此代理,但找不到从 DragEvent 对象获取的方法.

有可能吗?我想要的是在释放鼠标按钮时实际放下拖动的图像...... Flex 会自动在代理上制作一个很好的缩小动画,但我不想要那样.

Flex 示例展示了什么我不想要 - 删除了代理并添加了一个新图像,但位置不完全正确...

更多信息:我尝试将我的代理图像作为数据项添加到 DragSource.当发生下降时,我能够访问它并看到有一个类 mx.managers.dragClasses.DragProxy 它似乎包含我需要的所有信息......但这个类没有记录?

所以实际上有两个问题...如何获取代理并找出代理中鼠标光标的位置,以及如何禁用 Flex 放置动画.

解决方案

为了禁用 s:List 中的动画,在 dragCompleteHandler 覆盖中,您可以破解"到 DragManager 以获取 dragProxy 并将其隐藏.

>

覆盖受保护的函数 dragCompleteHandler(e:DragEvent):void{DragManager.mx_internal::dragProxy.visible = false;//<- 魔法!super.dragCompleteHandler(e);}

可能适用于其他情况.

When you start a Flex drag action, you pass in a proxy image to be displayed when you drag across the screen. When the drop occurs, I want to be able to grab this proxy but I can't find a way to from the DragEvent object.

Is it possible? What I want is to actually drop the dragged image when the mouse button is released... Flex automatically does a nice shrinking animation on the proxy but I don't want that.

The Flex examples show what I don't want - the proxy is removed and a new image added but not in exactly the right place...

More info: I tried adding my Proxy Image as a data item to the DragSource. I was able to access this when the drop occurred and saw there is a class mx.managers.dragClasses.DragProxy which seems to have all the info I need... but this class is not documented?

So there's two questions really... how to get the proxy and find out the position of the mouse cursor within the proxy, and how to disable the Flex drop animation.

解决方案

For disabling the animation in the s:List, in a dragCompleteHandler override, you can 'hack' into the DragManager to get the dragProxy and hide it.

override protected function dragCompleteHandler(e:DragEvent):void
{
  DragManager.mx_internal::dragProxy.visible = false; // <- MAGIC!
  super.dragCompleteHandler(e);
}

Probably applicable in other situations.

这篇关于Flex DRAG_DROP 事件 - 是否可以访问被拖动的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆