放入 HBox
我有这个带有放置功能的 HBox:
SCRIPT:
// The dragEnter event handler for the HBox container enables dropping.
private function dragEnterHandler(event:DragEvent):void
{
if (!event.dragSource.hasFormat("items"))
return;
var dropTarget:Box = Box(event.currentTarget);
dropTarget.setStyle("borderStyle", "outset");
DragManager.acceptDragDrop(dropTarget);
DragManager.showFeedback(DragManager.MOVE);
}
private function dragExitHandler(event:DragEvent):void
{
if (!event.dragSource.hasFormat("items"))
return;
var dropTarget:Box = Box(event.currentTarget);
dropTarget.setStyle("borderStyle", "inset");
}
MXML
<mx:HBox id="invoiceHBox" borderStyle="inset" borderThickness="3"
height="40" width="260"
dragEnter="{dragEnterHandler(event);}"
dragExit="{dragExitHandler(event);}"
dragDrop="{dragDropHandler(event);}">
<mx:VBox>
<mx:Image source="{MailIcon32}" visible="{Boolean(invoiceEmail)}" />
<mx:Label text="{invoiceEmail.name}" styleName="heading4" />
<mx:Text text="{invoiceEmail.description}"
width="100%" selectable="false" />
</mx:VBox>
</mx:HBox>
当鼠标进入 HBox 时,它工作正常。数据可以放入 HBox 中,并且函数 DragDropHandler(一个很长的函数)完成它的工作。
但是,当鼠标悬停在 VBox 上时,放置功能就会丢失。 VBox 容器可以以某种方式从 HBox 继承吗?或者这个问题还有其他解决方案吗?
谢谢!
I have this HBox with drop functionality:
SCRIPT:
// The dragEnter event handler for the HBox container enables dropping.
private function dragEnterHandler(event:DragEvent):void
{
if (!event.dragSource.hasFormat("items"))
return;
var dropTarget:Box = Box(event.currentTarget);
dropTarget.setStyle("borderStyle", "outset");
DragManager.acceptDragDrop(dropTarget);
DragManager.showFeedback(DragManager.MOVE);
}
private function dragExitHandler(event:DragEvent):void
{
if (!event.dragSource.hasFormat("items"))
return;
var dropTarget:Box = Box(event.currentTarget);
dropTarget.setStyle("borderStyle", "inset");
}
MXML
<mx:HBox id="invoiceHBox" borderStyle="inset" borderThickness="3"
height="40" width="260"
dragEnter="{dragEnterHandler(event);}"
dragExit="{dragExitHandler(event);}"
dragDrop="{dragDropHandler(event);}">
<mx:VBox>
<mx:Image source="{MailIcon32}" visible="{Boolean(invoiceEmail)}" />
<mx:Label text="{invoiceEmail.name}" styleName="heading4" />
<mx:Text text="{invoiceEmail.description}"
width="100%" selectable="false" />
</mx:VBox>
</mx:HBox>
When the mouse enters the HBox, it works fine. The data can be dropped into the HBox and the function dragDropHandler (a very long function) does its work.
However, when the mouse hovers over the VBox, the drop functionality is lost. Can the VBox container somehow inherit from the HBox? or is there another solution to this problem?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要禁用 HBox 的 mouseChildren 属性,它应该可以工作
You need to disable the mouseChildren property of the HBox and it should work