Hi, I am having strange problem with PopupMenuButton. I am having a popupmenubutton with submenus as its items.
When I click on the parent menu item( not on the sub menu item), how can i get the index of the parent menu item on which it is clicked. Which event gets triggered for this. The itemClick event is triggered only when we click on the sub menu item which is in the last hierarchy. Similarly when i click on the submenu item, i need the index of its parent menu with respect to popumenu button. Here is the code... When I click on Inbox or Calendar menu......i need its index(0 or 1)......Similarly when I click on Personal menu item...I need Inbox index(its parent menu index.) Please help.... <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.events.*; import mx.controls.*; //Event handler, invoked when you select from the menu. public function itemClickHandler2(event:MenuEvent):void { Alert.show("Menu label: " + event.label + " \n menu item index within parent menu: " + event.index); } ]]> </mx:Script> <!-- A an data provider in E4X format. --> <mx:XMLList id="treeDP2"> <node label="Inbox"> <node label="Personal" /> <node label="Marketing"/> <node label="To Do"/> </node> <node label="Calendar"> <node label="Appointments" data="6"/> <node label="Meetings"/> </node> <node label="Deleted Items"/> </mx:XMLList> <mx:Panel title="PopUpMenuButton Control Example" paddingTop="10" paddingLeft="10" paddingRight="10" x="10" y="205" height="143" width="271"> <mx:Label width="100%" color="blue" text="Click the down arrow to open the menu."/> <mx:PopUpMenuButton id="p2" dataProvider="{treeDP2}" labelField="@label" itemClick="itemClickHandler2(event);"/> </mx:Panel> </mx:Application> Thanks, Sudha.

