0 Replies Latest reply on Mar 20, 2008 7:04 AM by jfcaruso

    Can't display image contextMenu on Linux.

    jfcaruso
      I'm writing an Flex 3 (same issue in Flex 2)application where right clicking on an image should display my customized ContextMenu. The contentMenu is NOT displayed whenever I execute this application in Firefox on a RedHat Enterprise 4 Linux system. This issue doesn't occur on Windows based system (Firefox or IE). Attached is my sample application. Can anyone please help? Thanks

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application initialize="init(event)" xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      import mx.controls.Image;
      import mx.managers.PopUpManager;
      import mx.core.UIComponent;

      private var square:Sprite = new Sprite();
      // Image
      [Embed(source="../asset/images/pie-chart.png")]
      static public var iconClass:Class;

      public function init(event:Event):void
      {
      square.graphics.beginFill(0000000);
      square.graphics.drawRect(0,0,100,100);
      square.graphics.endFill();
      var newComponent:UIComponent = new UIComponent();

      //must set the UI component to wrap the sprite - so set width and height
      newComponent.width = 100;
      newComponent.height = 100;

      var menuItem:ContextMenuItem = new ContextMenuItem("Change Color");
      menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,changeColor);
      var customContextMenu:ContextMenu = new ContextMenu();

      //hide the Flash menu
      customContextMenu.hideBuiltInItems();
      customContextMenu.customItems.push(menuItem);

      var _imgObj:Image = new Image();
      _imgObj.source = iconClass;
      _imgObj.width = 25;
      _imgObj.height = 25;
      _imgObj.contextMenu = customContextMenu;
      newComponent.addChild(_imgObj);
      myPanel.addChild(newComponent);
      }

      public function changeColor(event:ContextMenuEvent):void
      {square.transform.colorTransform = getRandomColor();}

      public function getRandomColor():ColorTransform
      {return new ColorTransform(Math.random(), Math.random(), Math.random(),1,(Math.random() * 512) - 255, (Math.random() * 512) -255, (Math.random() * 512) - 255, 0);}
      ]]>

      </mx:Script>

      <mx:Panel id="myPanel"></mx:Panel>

      </mx:Application>