A fun problem with MouseEvent :O

Hey!

I just ran in to a little funny problem with MouseEvent!

What I did was to make a image-gallery class, and in that make a eventlistener for MouseEvent.Click for every individual image. And in the handler i’ve done a dispatchEvent. like this :


for(var i:int = 0; i < numImages; ++i) {
    image*.addEventListener(MouseEvent.CLICK, mouseClickHandler);
}

private function mouseClickHandler(e:MouseEvent):void
{
    dispatchEvent(e);
}

And then in the main-class I’ve made a listener for that, like this


imageGallery.addEventListener(MouseEvent.CLICK, mouseClickHandler);

private function mouseClickHandler(e:MouseEvent):void
{
    trace(e.target);
}

And what I get is multiple targets!


    [object imageGallery]
    [object image]

How do I make this access only one of these targets!? These don’t work:



    trace(e.target[0]);
    trace(e[0].target);


HELP!?

//Artheus