javascript - How can i acess numberText[i].text() in function inside onclick event of circles[i]? -
when access "numertext[i].text()" in function of circles[i]'s on click event handler firebug prompts error:"numbertext[i] undefined ". want assign text returned calling "numertext[i].text()" variable "score"
var score=0; for(var i=0;i<3;i++){ //adding number text numbertext[i]=new kinetic.text({ x:circles[i].getx(), y:circles[i].gety(), text:i, fill:'white', name:'ntext' }); group[i].add(circles[i],numbertext[i]); layer.add(group[i]); //zn click circles circles[i].on('click',function(){ score=numbertext[i].text(); //here "numbertext[i] undefined" error fires scoretext.text(score); layer.draw(); }); }
plz me
Comments
Post a Comment