Score Problems

I was just reading a tutorial ( and was wondering how to do this:

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?

Any suggestions?


Remove the instance name for the textfield and place thiis code on the timeline:

this.onEnterFrame = function(){
this.gotoAndPlay("Scene 4","1")

ahh good but… (yes i know theres always a catch)

My game never reaches 10000 exactly. How can i make it so if it reaches 10,000 OR over that it goes to scene 4?

thx :slight_smile:

this.onEnterFrame = function(){
                this.gotoAndPlay("Scene 4","1")

it still doesnt work! wut is wrong?

I dont know, but scenes sometimes can behave weird

and i cant post my game because the scene is too big!

You’re mixing things up… use a different instance name for the text field, something like score_txt. :stuck_out_tongue:

And there’s no need for an [font=courier new]onEnterFrame[/font] handler, you’re wasting resources; use the [font=courier new][/font] method instead.

function checkScore(prop, vold, vnew) {
	if (vnew>=10000) {
		this.gotoAndPlay("Scene 4", 1);
	return vnew;
}"score", checkScore);

Nice kax, never thought of using the watch method for that. Is that good for memory usage precaution?

Yeah (at least for me), I use it all the time for games and stuff. :slight_smile:

Do you know where i can find more info on memory usage in actionscript?

Uhmm… no, I don’t remember any. I’ll let you know if I find (or remember) anything. :wink:

Thanks :thumb:

No problem. :beam: