Hi All,

I was trying to get different context menus on different components;;

here is what I am trying to do:

Can someone please tell me how to get different context menus if I
click on LinkBut1 and LinkBut2...



<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" >
        <mx:LinkButton  id="Linkbut1" x="76" y="44" label="LinkButton"
rightClick="createContextMenu()"/>
        <mx:LinkButton id="Linkbut2" x="97" y="83" label="dddf"
rightClick="createContextMenu1()"/>

        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        var aboutTextMenu:ContextMenu;
                        var aboutTextMenu1:ContextMenu;

                        private function createContextMenu():void{
                                aboutTextMenu = new ContextMenu();
                                var conMenuItem:ContextMenuItem = new 
ContextMenuItem("ITEM 1");
                                
conMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
displayAboutText);
                                aboutTextMenu.customItems.push(conMenuItem);
                                this.contextMenu = aboutTextMenu;
                        }

                        private function createContextMenu1():void{
                                aboutTextMenu1 = new ContextMenu();
                                var conMenuItem:ContextMenuItem = new 
ContextMenuItem("ITEM 2");
                                
conMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
displayAboutText1);
                                aboutTextMenu1.customItems.push(conMenuItem);
                                this.contextMenu1 = aboutTextMenu1;
                        }

                        private function 
displayAboutText(event:ContextMenuEvent):void{
                                Alert.show("hi1");
                        }

                        private function 
displayAboutText1(event:ContextMenuEvent):void
{
                                Alert.show("hi2");
                        }

                ]]>
        </mx:Script>
</mx:WindowedApplication>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to