# ContextMenu closing with strange results

**URL:** <https://forum.kirupa.com/t/contextmenu-closing-with-strange-results/305338>\
**Category:** flash\
**Created:** [February 23, 2010, 7:24pm UTC](https://forum.kirupa.com/t/contextmenu-closing-with-strange-results/305338 "2010-02-23T19:24:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisstolte](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@chrisstolte](https://forum.kirupa.com/u/chrisstolte)\
**Post date:** [February 23, 2010, 7:24pm UTC](https://forum.kirupa.com/t/contextmenu-closing-with-strange-results/305338/1 "2010-02-23T19:24:37Z")

</div>

Hello,

I have a very simple AIR app (Flex 3.4.1, source below…), that has only two things:

1. a canvas with an event listener to trace the mouse location
2. a simple context menu

I notice that the event listener for the mouse move seems to stop working when I do the following:

a. pop up the context menu  
b. highlight the “test” item but do not select it  
c. close the popup by clicking off the menu (on the canvas)

I am using Mac OS X (Snow Leopard), and I further notice that if I press Command-~ (as if I were toggling open windows) the listener returns. Lastly, I notice that if I pop up the menu but don’t highlight the item before clicking off, everything works as expected.

All of this leads me to believe that somehow highlighting the menu item creates a “window” that isn’t being properly disposed of in this particular case when I click off - does anybody have a suggestion of what might be going on here?

Thank you,  
Chris Stolte

* * *

\<mx:WindowedApplication layout=“absolute” applicationComplete=“init()”  
xmlns:mx=“[http://www.adobe.com/2006/mxml](http://www.adobe.com/2006/mxml)”\>  
\<mx:Script\>  
\<![CDATA[

```
        private function init():void {
            // Listener to trace mouseX property
            myCanvas.addEventListener(MouseEvent.MOUSE_MOVE,
                    function (e:MouseEvent):void {
                        trace(myCanvas.mouseX);
                    });
            
            // Create a simple context menu
            myCanvas.contextMenu= new ContextMenu();
            myCanvas.contextMenu.addItem(new NativeMenuItem("test"));
        }
        
    ]]&gt;
&lt;/mx:Script&gt;
&lt;mx:Canvas id="myCanvas" height="50%" width="50%" backgroundColor="0x00FF00"/&gt;

```

\</mx:WindowedApplication\>
