views:

143

answers:

2

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?

+1  A: 

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.

Ross Henderson
What would you add the mouse move listener too? And the problem I'm having is explained in that other question, so if you have another answer to that, then we wouldn't have to worry about the "babysitter".
invertedSpear
OK JONYC helped me with what to attach the event to, It's not the ideal way but it looks like it's working. thanks for your help
invertedSpear
+1  A: 

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...
JONYC
I wish I could accept from both of you. You'll have to settle for an upVote :)
invertedSpear