Snippets (AS3): MouseEvent targets nested child objects

Annoying. If you have objects with child objects and put addEventListener(MouseEvent.CLICK, mouseClickEvent); on it,

function mouseClickEvent(e:MouseEvent):void

will trace the child objects instead of the parent. I’m not exactly sure why that happens, but putting MovieClip.mouseEnabled = false; on every child object helps (which was OK in my case).

Found here:

1 Thought.

  1. hi there
    Mouse click is archaic, prefer mousedowns/ups

    If you still haven’t figured it out
    it’s because you should use e.currentTarget and not target

    cheers !

Leave a Reply

Your email address will not be published. Required fields are marked *



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>