Keep getting error when using a js Ticker with a dynamic text field
I’m working on incrementing a dynamic text field over time. I’ve tried a few different methods but the Ticker seems to be the best, but for some reason I keep getting a “Cannot set properties of undefined (setting 'text')” error when trying to set the field in the Ticker function.
I’ve tried setting the text field outside the function and it works just fine. I’ve also tried initializing the text field in a frame well in advance of the function, but that didn’t help either. If I send the function output to the console instead of the text field, it works just fine.
Here’s my code. Any ideas?
Thanks!
var i = 0;
createjs.Ticker.on("tick", tick);
function tick() {
this.bunting_count.text = i;
//console.log(i);
i++;
}
