Increase a variable in Dynamic Text field with JS
Hi there,
I got a button on the stage and a variable set to 0.
I would like to increase the value of the variable every time the user clicks on the button.
I try this code but not sure about the function...
//dtc_Hits is the instance name of the dynamic text field;
//inst_ButtonMovie is the instance name of the button to be clicked
var Hits = 0;
this.dtc_Hits.text = Hits
this.inst_ButtonMovie.on("click", function(increaseHits) {
Hits++;
})
PS. I know that the error is in the line Hits++ because I try an alert message and it works...