views:

121

answers:

1

Hi,

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.

+2  A: 

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).

spender