开发者

Flex/AS3 easy (I hope) drag and drop question - prevent dragging to other controls

开发者 https://www.devze.com 2022-12-14 12:28 出处:网络
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 i

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开发者_Python百科 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消