Maksim Vi.
Maksim Vi.

Reputation: 9225

Flash. Prevent mouse drag on child

I have a movieclip with a child button in it. The movieclip can be dragged and dropped. I want to disable dragging and dropping of the movieclip when I press/drag on the child button. mouseChildren=false and mouseEnable=false don't work, since I want to keep my mouse events for the button.

 ---------------------------------
| Movieclip         ---------     |
|                   |Button |     |    
|                   |       |     |
|                   ---------     |
 ---------------------------------

Thanks.

Upvotes: 1

Views: 829

Answers (1)

spender
spender

Reputation: 120480

I can't remember the specifics, but you can use standard event listeners on the button and prevent those events from being received on the MovieClip underneath it. You need to cancel the event in the button's listening handler.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/Event.html#stopPropagation%28%29

If you find that the MovieClip has already received the event, change your Button listener to listen in the capture phase of the event(useCapture parameter of addEventListener).

Upvotes: 2

Related Questions