How do I detect that Drag and Drop operation ended?
This is in reference to My Other Question
How do can you detect and dispatch an event when a drag and drop operation ends prematurely? I need to know that the user is no longer dragging an item. Even if the dragDrop and dragComplete events do no fire. Its almost as if I need to add an 开发者_开发知识库event listener to the dragManager, but that's not really possible... is it?
It looks like basically you need to be able to tell if the DragManager craps out. Even if there was an ERROR event in the drag/drop system (there isn't that I've seen, but maybe I've missed something obvious), you probably couldn't always count on it.
Sort of like trying to set up a client to know when the server has died kind of thing, yeah?
I may be way off, but I'm thinking you could add a mouseMove listener when you begin your drag and constantly check to see if you are still dragging. I believe you can dynamically set how often that mouseMove event fires.
And, of course, once you complete the drag - whether maturely or prematurely - remove the mouseMove listener.
I'm really not crazy about doing something like this. Adding a babysitter to an operation. But I think it'd do what needs doing, and I don't think it needs to be messy.
For Flash Builder 4, try to use:
DragEvent.DRAG_EXIT
Otherwise, you can use a stage event listener to listen for mouse out
stage.addEventListener(MouseEvent.MOUSE_OUT...
Listen to dragComplete event type of drag initiator.
精彩评论