I want to get an index of menuItem.
How can I get it in the menuItem function?
var button=[];
var menu;
for(var i=0;i<3;i++){
button[i]=new cc.MenuItemImage(
res.ball_png,
res.ball_png,
function(){
cc.log(i); // this part
},this);
button[i].setTag(i);
button[i].x=100*i;
}
menu=new cc.Menu(button);
this.addChild(menu);