0 Replies Latest reply on Nov 14, 2008 3:10 PM by riesvantwisk

    ContextMenuItem with a single respond function problem...

    riesvantwisk Level 1

      I am dynamically generating a context menu much like this:

      cmia = new Array();
      var ccc:int =1;
      for each (var m:XML in matched) {
      cmi = new ContextMenuItem(m.info.toString(), true);
      cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function (e:Event) {contextMenuItem_menuItemSelect(e,m,ccc);});

      (This is mostly test code)
      And my responder function look smuch like this:

      private function contextMenuItem_menuItemSelect(e:Event, m:XML, c:int):void {
      Alert.show(m._id.toString(), ":"+c );

      My problem is as follows,
      when I create for example two context menu's, then the Alert and trace always shows data of the latest added item,
      in the case where I show the number it's always 3 (not even 2!!!!)

      Is there a way to figure out from the event listener to know what menu item was pressed? Currently I have no way of knowing.

      Ries van Twisk