The solution I put in place for a similar problem...

Add some javascript to eat the right click event (so the default menu
isn't shown), and have it dispatch an event to the application.

The application then dispatches a "RIGHT_CLICK" event having it bubble.

Any UI component listening for that event captures is and prevents it
from bubbling further (You want to let it get to the topmost point in
the display list, and catch it on the way back down).

That UI component opens up the menu you've set up for it.

 

Gk.

Gregor Kiddie
Senior Developer
INPS

Tel:       01382 564343

Registered address: The Bread Factory, 1a Broughton Street, London SW8
3QJ

Registered Number: 1788577

Registered in the UK

Visit our Internet Web site at www.inps.co.uk
<blocked::http://www.inps.co.uk/> 

The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it
by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
INPS or any of its affiliates. If you are not the intended recipient
please contact is.helpd...@inps.co.uk

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Michael Pelz-Sherman
Sent: 29 January 2009 19:53
To: flexcoders@yahoogroups.com
Subject: [flexcoders] dynamic context menu problem

 

I'm struggling to find an elegant solution to this problem:

 

I have a Flex app that has a dynamic context (right-click) menu.

 

The menu contains different items depending on whether various objects
are selected.

 

Ideally, I'd like to re-generate the menu options right when the user
right-clicks, but I haven't found a reasonable way to do this.

 

So instead I'm re-generating the menus every time the user (left)
clicks, which is kind of expensive and is having unwanted side-effects.

 

Unfortunately, MouseEvent.RIGHT_CLICK is AIR-only.

 

Any suggestions would be most appreciated!

 

- Michael

 

Reply via email to