0 Replies Latest reply on Aug 10, 2011 3:41 AM by Shripad_joshi

    I want to show Menu in my app, but why does it throw null object reference for IActiveWindowManager?

    Shripad_joshi

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application applicationComplete="onApplicationComplete()" preloader= "preload.CustomPreloader"   xmlns:mx="http://www.adobe.com/2006/mxml"      xmlns:myComp="myComponents.*" layout="absolute" creationComplete="creationCompleteHandler();" backgroundColor="#FFFFFF"      scriptTimeLimit="55"  layoutDirection="ltr">

           <mx:Script>

                <![CDATA[

                     import mx.managers.PopUpManager;

       

                     private var _designerMenu:Menu;

       

                     protected function onMenuClick(event:ContextMenuEvent):void {

                          var designerMenu:DesignerMenus = new DesignerMenus();

                          _designerMenu = designerMenu.addMenu();

                       //   _designerMenu.addEventListener(MenuEvent.ITEM_CLICK, onDesignerMenuItemClick);

                          _designerMenu.show();

                     }

                ]]>

           </mx:Script>

       

           <mx:Button label="Menu" click="onMenuClick"/>

      </mx:Application>

       

       

       

       

       

      <!-- my menu designer component in MXML-->

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Box xmlns:mx="http://www.adobe.com/2006/mxml">

       

      <mx:Script>

      <![CDATA[

       

      import mx.controls.Menu;

      import mx.events.MenuEvent;

       

      private var _designerMenus:Menu;    // ADD menus for designer.

       

      // public static constant declarations of menuItems

      public static const VIEW:String = "View";

       

      public static const AREA_CHART:String = "Area Chart";

      public static const BAR_CHART:String = "Bar Chart";

      public static const BUBBLE_CHART:String = "Bubble Chart";

      public static const LINE_CHART:String = "Line Chart";

      public static const PIE_CHART:String = "Pie Chart";

       

      public static const ANGULAR_GAUGE:String = "Angular";

      public static const BULB_GUAGE:String = "Bulb";

      public static const CYLINDER_GUAGE:String = "Cylinder";

      public static const LINEAR_GUAGE:String = "Linear";

      public static const THERMOMETER_GUAGE:String = "Thermometer";

       

      public static const GRID:String = "Grid";

      public static const IMAGE:String = "Image";

       

      public static const H_SLIDER:String = "H-Slider";

      public static const V_SLIDER:String = "V-Slider";

      public static const INPUT_BOX:String = "Input Box";

       

      public static const LABEL:String = "Label";

       

      /*

      * Shripad: 26-7-11

      * this function creates menus for designer using xml data.

      * param:null

      */

      public function addMenu():Menu {

      _designerMenus = Menu.createMenu(this,designerMenuData,false);

      // _designerMenus.addEventListener(MenuEvent.ITEM_CLICK, menuItemClickHandler);

      _designerMenus.labelField = "@label";

      return _designerMenus;

      }

      ]]>

      </mx:Script>

       

      <mx:XML xmlns="" id="designerMenuData" format="e4x">

      <root>

      <menuItem label = "View"/>

      <menuItem type = "separator"/>

      <menuItem label = "Pod">

      <menuItem label = "Chart">

      <menuItem label = "Area Chart"/>

      <menuItem label = "Bar Chart"/>

      <menuItem label = "Bubble Chart"/>

      <menuItem label = "Line Chart"/>

      <menuItem label = "Pie Chart"/>

      </menuItem>

       

      <menuItem label = "gauge">

      <menuItem label = "Angular"/>

      <menuItem label = "Bulb"/>

      <menuItem label = "Cylinder"/>

      <menuItem label = "Linear"/>

      <menuItem label = "Thermometer"/>

      </menuItem>

       

      <menuItem label = "Grid"/>

       

      <menuItem label = "Image"/>

       

      <menuItem label = "Input">

      <menuItem label = "H-Slider"/>

      <menuItem label = "V-Slider"/>

      <menuItem label = "Input Box"/>

      </menuItem>

       

      <menuItem label = "Label"/>

      </menuItem>

      </root>

      </mx:XML>

       

      </mx:Box>