Search code examples
actionscript-3flashbuttonevent-bubblingevent-propagation

AS3: What is the best way to put button-behaviors ONLY on child_mcs of a container_mc


I have a container_mc, with lots of child_mcs inside. I want the child_mcs to have full button-like behaviors (click-able, cursor effects).

I am not interested in putting individual mouse listeners on every child. ... I would like to simply have one listener on the parent container, though the parent would effectively be inactive ... only the child_mcs.


Solution

  • please ignore the downvote ... if your problem is the same as mine, then this solution works

    //-- pseudo code --\\
    
    *for the container:*
    container.addEventListener( MouseEvent.MOUSE_DOWN , callback_function ) ;
    container.buttonMode ...... false
    container.mouseEnabled .... false
    container.mouseChildren ... true
    
    *for each child:*
    child.buttonMode ...... true
    child.mouseEnabled .... true
    child.mouseChildren ... false