R – How to detect that Drag and Drop operation ended

actionscriptactionscript-3apache-flexflex3

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?

Best Answer

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.

Related Topic