Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-33593

mx.controls.MenuBar#mouseOutHandler TypeError

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Apache Flex 4.9.0
    • Fix Version/s: Apache Flex 4.10.0
    • Component/s: mx: Menu Bar
    • Labels:
      None

      Description

      When changing MenuBar dataProvider within click on Menu sometimes causes a TypeError in mouseOutHandler.

      I solved this with following workaround:

      public override function addChild(child:DisplayObject):DisplayObject
      {
      if( child is IMenuBarItemRenderer )

      { var item: IMenuBarItemRenderer = IMenuBarItemRenderer( child ); item.addEventListener( MouseEvent.MOUSE_OUT, patchedMouseOutHandler, false, int.MAX_VALUE ); }

      return super.addChild( child );
      }

      private function patchedMouseOutHandler( event: MouseEvent ) : void
      {
      //stop the event to avoid npe
      event.stopImmediatePropagation();
      event.stopPropagation();

      var item:IMenuBarItemRenderer = IMenuBarItemRenderer(event.target);
      var index:int = item.menuBarItemIndex;
      var m:Menu = getMenuAt(index);

      if (item.enabled && selectedIndex != index)

      { if( menuBarItems.indexOf( item ) >= 0 ) menuBarItems[index].menuBarItemState = "itemUpSkin"; }

      // Fire the appropriate rollout event
      if (item.data &&
      (m.dataDescriptor.getType(item.data) != "separator"))

      { var menuEvent:MenuEvent = new MenuEvent(MenuEvent.ITEM_ROLL_OUT); menuEvent.index = index; menuEvent.menuBar = this; menuEvent.label = itemToLabel(item.data); menuEvent.item = item.data; menuEvent.itemRenderer = item; dispatchEvent(menuEvent); }

      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              philipmair Philip Mair
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified