I have created a custom ContextMenuItem and added it to the ContextMenu. The custom menu item has a listener and this all works as intended. However, I need to calculate the position of the cursor when I right click, this also corresponds to the top left corner of the ContextMenu.
The problem I have is that these values do not seem to be stored and I do not know how they can be calculated. The mouseTarget x and y values that are stored in the ContextMenuEvent relate to the mouse position when the menu item is clicked not the position of the right click.
Any help would be appreciated.
Trap MouseEvent and use stageX/stageY or localX/localY as per your need.
I have tried using MouseEvent.CLICK and adding it to the enclosing Component but this does not get triggered with a RightClick but works fine when using the left mouse button.
Is there a specific event type I need to use or does the listener need to be added to a different Component.