Visible Certainty - The Verifiable.com Blog

Sep 28 2009

Modifying context menus with Flash Player 10 while avoiding crashes under Windows XP

(This is a post on coding.  It has little to do with charting, but we ran into this problem and thought someone else might too)

In our app, we like to modify the context menu (what you get when you right-click) to have context-useful items.  Not exactly groundbreaking.  This has worked great for months.  But recently, we received a bug report from a Windows XP user.  It seems that the most recent versions of Flash Player 10 (we haven’t yet isolated when this bug started appearing) contains a bug that can get tickled when modifying the menu.  The symptom is simple: a user right clicks, selects an item from the menu, and their browser crashes.  That’s right: the browser crashes.  Woot!

We discovered the underlying cause, which as far as we can tell, shouldn’t cause problems (according to the Flex documentation), but it clearly does.  The cause is assigning contextMenu more than once, or removing items from contextMenu.customItems.

Therefore, the fix is straightforward, if a little ugly(?): Assign contextMenu and populate customItems with all your potential context menu items only once. Disable or enable individual ContextMenuItems in contextMenu.customItems based on the context.

The rest is left as an exercise for the reader.

— Jason

Comments (View)
blog comments powered by Disqus
Page 1 of 1
I want my StackExchange