Skip to main content
Inspiring
March 24, 2009
Question

How to Detect if You Haven't Dragged the Movie Clip?

  • March 24, 2009
  • 2 replies
  • 416 views
I have the standard drag and drop functionality setup with the MOUSE_DOWN / MOUSE_UP commands. However, if I just click on the item and decide not to drag, it still executes the commands like it was dragged. Is there any code I can put in so that if they decide not to drag the movie clip, the function doesn't fire?

Thanks.

Dave
This topic has been closed for replies.

2 replies

March 24, 2009
Can you move the functionality you don't want always firing to an event handler that responds to the MOUSE_MOVE event? Then if the clip is being dragged, it can fire the moving stuff, but if it isn't being dragged, the code won't fire.

Maybe another possibility is to have the functions look at start and end positions of the draggable clip, and if they are the same then not firing the code, but if they're different, execute code as appropriate.

Just thinking out loud here basically, I hope it helps.
March 24, 2009
Can you set a boolean flag that begins as false, and is only set to true when the item in question is actually dragged? Then the code that runs on dragging can be contained within an if statement that checks the flag prior to firing.
Inspiring
March 24, 2009
Since the commands are executed by MOUSE_DOWN and the MOUSE_UP events, it always runs those functions based on the mouse events. So in other words, a variable of "dragged" is always going to be true if they have clicked the mouse. I guess I need to detect if its been moved or something like that.

Thanks for the comments.

Dave