Hi,

Below is sample code to display the ContextMenu in AIR,

private function OnMouseDown(event:MouseEvent)
{
       var cm:ContextMenu=new ContextMenu();
       var cmi:ContextMenuItem=new ContextMenuItem("Test");
      cm.display(event.target.stage,event.localX,event.localY);
}

Hope this helps.

-Vijay

On Mar 29, 2:36 am, velu <[email protected]> wrote:
> Try this code ... taken long time back from internet i think..
>
> [code]
>
> package {
>         import flash.display.NativeMenu;
>         import flash.display.NativeMenuItem;
>         import flash.events.Event;
>         public class DeclarativeMenu extends NativeMenu {
>                 public function DeclarativeMenu(XMLMenuDefinition:XML):void {
>                         super();
>                         addChildrenToMenu(this, XMLMenuDefinition.children());
>                 }
>                 private function addChildrenToMenu(menu:NativeMenu,
>                 children:XMLList):NativeMenuItem {
>                         var menuItem:NativeMenuItem;
>                         var submenu:NativeMenu;
>                         for each (var child:XML in children) {
>                                 if (String(chi...@label).length > 0) {
>                                         menuItem = new 
> NativeMenuItem(chi...@label);
>                                         menuItem.name = child.name();
>                                 } else {
>                                         menuItem = new 
> NativeMenuItem(child.name());
>                                         menuItem.name = child.name();
>                                 }
>                                 menu.addItem(menuItem);
>                                 if (child.children().length() > 0) {
>                                         menuItem.submenu = new NativeMenu();
>                                         
> addChildrenToMenu(menuItem.submenu,child.children());
>                                 }
>                         }
>                         return menuItem;
>                 }
>         }//End class}//End package
>
> [/code]
>
> -sara
> On Mar 28, 2:00 am, Rahul Sood <[email protected]> wrote:
>
>
>
> > Hi,
>
> > I could not find any code for adding COntextMenu in an AIR application.
> > The code given here works in Flex, but not in 
> > AIR:http://blog.flexexamples.com/2007/08/20/using-a-custom-context-menu-w...
>
> > Can somebody tell me where I could be wrong.
> > Thanks,
> > Rahul.
>
> > --
> > "Learning is not necessary, neither is survival"- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
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