Passing an argument to MenuItem function

Hi,

I want to pass an argument to a MenuItemSprite function.
I’m setting the tag, but I’m not getting the expected result.
So I must be getting it wrong. Maybe I should not use this.tag there?
Don’t know how to get the sender in js.

I post my code. Thanks in advance.

var bufItem = new cc.MenuItemSprite(
              new cc.Sprite(res.bt_empty_normal_png),
              new cc.Sprite(res.bt_empty_hover_png),
              new cc.Sprite(res.bt_locked_png),
              function () {
                cc.log("tag:"+this.tag);
               },
             this);

bufItem.setTag(9);

It’s likely just function(sender) { cc.log("tag:" + sender.tag); } and if not then you may need to find the call site to determine what arguments are passed when the menu item is activated.

It works flawlessly. Thanks mate :smile: