• Content Count

  • Joined

  • Last visited

  1. I used a global variable to generate all the buttons. But by using a local variable all works fine.
  2. Hey out there, I created some buttons like this: generateButtons() { for (var i = 0, j = 0; i < 3; i++, j++) { console.log(i); //shows 0,1,2 //create upgrade button this.upgradeButton =, 225 + (j * 165), 'skillButton', function helper() { this.dosth(; }, this, 2, 1, 0); = 'button' + i; }}dosth(buttonname) { console.log('show me the clicked buttonname: ' + button name); //always 'button2'}And now i want to detect the exact name-attribute of the pressed button in the "dosth"-function. But i always get the name of the latest number of the "i" - in this case its: "button2". I know i can create three separate buttons but i would like to do it in a dynamic way. Can anyone give me some advice? Thanks