如何更改 AS3 中的 DragManager 拒绝符号?
我第一次在 flex4/as3 中开发拖放功能。我使用 DragManager 类,基本的拖放功能现在可以工作了。但是,如何更改当我将对象拖动到无法放置的区域时显示的红色小“拒绝光标”?
我可以在此处的样式规范中找到“rejectCursor”: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/DragManager.html#styleSummary
但是我不知道如何在 AS3 中设置。我必须使用CSS吗?如果是的话,你能给我一个简单的例子吗?会很有帮助的!谢谢。
I'm working on a drag-n-drop functionality in flex4/as3, for the first time. I use the DragManager-class, and the basic drag-and-drop stuff works now. But, how do i change the little red "reject cursor" which is displayed when i drag objects over areas where i can't drop it?
I can find "rejectCursor" in the styles specification here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/DragManager.html#styleSummary
But I have no idea about how to set in in AS3. Do i have to use css, and if yes, could you give me a quick example? Would be very helpful! Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用
标记来声明全局样式:Edit: 要从 AS3 类而不是从 MXML 执行此操作,您可以使用:
You need to use the
<fx:Style>
tag to declare the global style:Edit: To do this from an AS3 class instead of from MXML, you would use:
通常在 AS3 中,您可以像这样在 Flex 组件上设置样式:
但是,由于 DragManager 不扩展 UIComponent,因此不存在 setStyle 方法。从这里开始,我有点猜测。
如果你深入研究代码;你会发现 DragProxy 类和一个 showFeedback 方法,其中有一个如下所示的片段:
因此,你可以尝试在 DragProxy 的实例上设置该样式;但您需要访问 DragProxy 实例。看起来您需要使用 mx_internal 执行此操作:
然后您可以执行以下操作:
Generally in AS3 you can set a styles on a Flex Component like this:
However, since DragManager does not extend UIComponent the setStyle method does not exist. From here, I'm guessing a bit.
If you dig into code; you'll find the DragProxy class, and a showFeedback method, which has a segment like this:
So, you could try setting that style on the instance of the DragProxy; but you'll need access to the DragProxy instance. It looks like you need to use mx_internal do that:
Then you can do something like this: