I already have a dynamic text box with the instance name “score” and the variable “score”. I want to go to scene 4 when the score reaches 10,000. But the tutorial only explains how to do it when a button is pressed down. How do I get it to work when my “score” reaches 10,000?
You’re mixing things up… use a different instance name for the text field, something like score_txt.
And there’s no need for an [font=courier new]onEnterFrame[/font] handler, you’re wasting resources; use the [font=courier new]Object.watch()[/font] method instead.
function checkScore(prop, vold, vnew) {
if (vnew>=10000) {
this.unwatch("score");
this.gotoAndPlay("Scene 4", 1);
}
return vnew;
}
this.watch("score", checkScore);