1 Reply Latest reply on Aug 24, 2006 11:55 AM by 6dust

    use of contextmenu will crash in new flashplayer

    ckshah Level 1
      hi all,

      i am using flex 2.0 final addition to create context menu support in my application

      i am sucessfully able to create context menu but when i am trying to select any item from contextmenu in flash player 9.0 final release it will crash the aplication insteadof opening a popup menu according to my application

      so can any one tell me what was exact prob to solve this situation because right now i am migrating my application frm flex beta 3 to flex final...and this menu also work perfactly in beta3 but same thing not working in final version...

      here it is code..

      ContextMenu myContextMenu = new ContextMenu();
      var item:ContextMenuItem;
      this.contextMenu = myContextMenu;
      item = new ContextMenuItem("Criar pasta para "+folder);
      myContextMenu.customItems.push(item);
      item.addEventListener(flash.events.ContextMenuEvent.MENU_ITEM_SELECT, function():void{menuItemCreateFolderHandler(folderData);});
      ****************************************************************************************** **********
      private function menuItemCreateFolderHandler(folderData:String):void
      {
      vAction="create";
      showWindow(true,folderData);
      }
      *******************

      plz give me proper solution aasp...

      thanks in advance

        • 1. use of contextmenu will crash in new flashplayer
          6dust
          Edit:

          DOH! Please ignore my question; I figured it out. It looks like it was related to the fact that I was attempting to remove the ContextMenu item on mouseOut of the button, and when moving the mouse to select that menu item, the mouseOut occurred.

          ---------------------------------------------------------

          Was a solution ever found for this, or a bug filed?

          I'm running into similar issues now that I'm starting to play with ContextMenus. The menu options appear fine, but when an option is selected, the browser crashes.

          In the sample below, 'ROOT' is added to the context menu for the panel. Clicking this causes no problems. Hovering over either button adds a new menu entry below 'ROOT' and if it is clicked, that is when the crash occurrs.

          Sample Code:

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application pageTitle="Testing ContextMenu" xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="addContextMenu()">
          <mx:Script>
          <![CDATA[
          import mx.controls.Label;
          import mx.controls.Alert;

          public var myContextMenu:ContextMenu = new ContextMenu();

          private function addContextMenu():void
          {
          myContextMenu.hideBuiltInItems();
          myContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, menuSelectHandler);
          myPanel.contextMenu = myContextMenu;
          var item:ContextMenuItem = new ContextMenuItem('ROOT');
          myContextMenu.customItems.push(item);
          item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
          }

          private function secondMenuAdd(buttonLabel:String):void
          {
          var item:ContextMenuItem = new ContextMenuItem(buttonLabel);
          myContextMenu.customItems.push(item);
          item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
          }
          private function secondMenuRemove():void
          {
          myContextMenu.customItems.pop();
          }
          private function menuItemSelectHandler(event:ContextMenuEvent):void
          {

          }
          private function menuSelectHandler(event:ContextMenuEvent):void
          {

          }
          ]]>
          </mx:Script>
          <mx:Panel top="10" bottom="10" left="10" right="50" id="myPanel" layout="horizontal">
          <mx:Button label="change menu" id="changeButton" mouseOver="secondMenuAdd(event.target.label)" mouseOut="secondMenuRemove()" />
          <mx:Button label="second menu" id="secondButton" mouseOver="secondMenuAdd(event.target.label)" mouseOut="secondMenuRemove()" />
          </mx:Panel>
          </mx:Application>