So I need to simulate a click on a specific position on some DisplayObject. That’s easy:
myObject.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN, true, true, 200, 200));
The problem I’m having is that I need to dispatch a MouseEvent on some button IF it’s at the position of the click in the container. But that won’t happen so far…
My logic is that if I dispatch the event directly on the container, the event can’t be dispatched on some child. But I’m not sure that is correct.
So how can I do that?
How can I dispatch an even to a DisplayObject and affect its children if there are indeed children at
Any ideas?
TIA
So I figured it out.
I need to use getObjectsUnderPoint() first to know what objects are under the coordinates, then figure out which is the top object, and then generate the MouseEvent on that object.