R – Flex:: How to prevent in drag and drop, dragging onto self

apache-flexdrag and drop

I have a Flex question. I was wondering, if I have two list boxes, and I want to drag and drop between both of them, how do I prevent the user from dragging onto the same list (thus duplicating the item? I cannot have a situation where that is the case. Thanks guys

Best Answer

Haven't tested it but I guess something like this should work:

Listen to dragStart event on both lists and set a source variable depending on event.target. Now listen to the dragDrop event on both lists and call event.preventDefault() if the source is same as the target.

Related Topic