# dispatchEvent for a virtual mouseClick doesn't hit children like a real click would

**URL:** https://forum.kirupa.com/t/dispatchevent-for-a-virtual-mouseclick-doesnt-hit-children-like-a-real-click-would/327322
**Category:** flash
**Created:** [February 21, 2012, 8:05pm UTC](https://forum.kirupa.com/t/dispatchevent-for-a-virtual-mouseclick-doesnt-hit-children-like-a-real-click-would/327322 "2012-02-21T20:05:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![cakepizza](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@cakepizza](https://forum.kirupa.com/u/cakepizza)
#### Post date: [February 21, 2012, 8:05pm UTC](https://forum.kirupa.com/t/dispatchevent-for-a-virtual-mouseclick-doesnt-hit-children-like-a-real-click-would/327322/1 "2012-02-21T20:05:55Z")

</div>

I have bitmap generated each frame and when clicked needs to simulate a click at a specific pixel in a separate movie clip.

If you really click on a movie clip, the event trickles down the hierarchy of children to dispatch click events for all children as well. If you have a button in a button in a button in a button… and you click the top button, the click event is dispatched for all buttons in the hierarchy, but my problem is that if I “virtual” click like…

```auto
var myClick=new MouseEvent(MouseEvent.CLICK,false,true);
myClick.localX=X; myClick.localY=Y; 
someMovieClip.dispatchEvent(myClick);

```

it only registers as a click for “someMovieClip” and not any buttons that are at that same click point within “someMovieClip”.

My idea for a solution is to loop through the whole hierarchy of children doing a hitTestPoint() and for each hit converting to local coordinates and and doing another dispatchEvent().

I just want to check if anyone has a more elegant solution or knows if I am just missing some setting or something that would make it act like a “real” click. It just seems like something that would be built in to flash, but maybe not.
