Here's an example where the right-mouse-click ContextMenu has two items one of which has a sub-menu. The menu appears fine on right mouse click the first time but on the next right mouse click, the menu item with a sub-menu disappears! In the example File and Edit menu items appear the first time with File showing a Open sub-menu item. The next time you right mouse click, only the Edit item shows. File and its sub-menu is gone. Please HELP!
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationCompleteHandler()"> <mx:Script> <![CDATA[ private function creationCompleteHandler():void { var cMenu:ContextMenu = new ContextMenu(); // file menu item var file:ContextMenuItem = new ContextMenuItem("File"); cMenu.customItems.push(file); // edit menu item var edit:ContextMenuItem = new ContextMenuItem("Edit"); cMenu.customItems.push(edit); // file's sub-menu var subMenu:NativeMenu = new NativeMenu(); var open:NativeMenuItem = new NativeMenuItem("Open"); subMenu.addItem(open); file.submenu = subMenu; this.contextMenu = cMenu; } ]]> </mx:Script> <mx:Panel id="pnl" width="100%" height="100%"/> </mx:WindowedApplication>