# Score Problems

**URL:** <https://forum.kirupa.com/t/score-problems/35631>\
**Category:** flash\
**Created:** [November 16, 2003, 4:53am UTC](https://forum.kirupa.com/t/score-problems/35631 "2003-11-16T04:53:26Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeka](https://avatars.discourse-cdn.com/v4/letter/z/c6cbf5/32.png) [@zeka](https://forum.kirupa.com/u/zeka)\
**Post date:** [November 16, 2003, 4:53am UTC](https://forum.kirupa.com/t/score-problems/35631/1 "2003-11-16T04:53:26Z")

</div>

I was just reading a tutorial ([http://www.flashkit.com/tutorials/Games/How\_to\_m-MODVDO-969/index.php](http://www.flashkit.com/tutorials/Games/How_to_m-MODVDO-969/index.php)) 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?

:h:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 4:58am UTC](https://forum.kirupa.com/t/score-problems/35631/2 "2003-11-16T04:58:14Z")

</div>

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

```auto
this.onEnterFrame = function(){
if(this.score==10000){
this.gotoAndPlay("Scene 4","1")
}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 5:09am UTC](https://forum.kirupa.com/t/score-problems/35631/3 "2003-11-16T05:09:53Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 5:14am UTC](https://forum.kirupa.com/t/score-problems/35631/4 "2003-11-16T05:14:51Z")

</div>

```auto
this.onEnterFrame = function(){
        if(this.score>=10000){
                this.gotoAndPlay("Scene 4","1")
        }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 5:47am UTC](https://forum.kirupa.com/t/score-problems/35631/5 "2003-11-16T05:47:25Z")

</div>

it still doesnt work! wut is wrong?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 5:48am UTC](https://forum.kirupa.com/t/score-problems/35631/6 "2003-11-16T05:48:18Z")

</div>

I dont know, but scenes sometimes can behave weird

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 5:52am UTC](https://forum.kirupa.com/t/score-problems/35631/7 "2003-11-16T05:52:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 7:33am UTC](https://forum.kirupa.com/t/score-problems/35631/8 "2003-11-16T07:33:43Z")

</div>

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.

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 7:48am UTC](https://forum.kirupa.com/t/score-problems/35631/9 "2003-11-16T07:48:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 7:53am UTC](https://forum.kirupa.com/t/score-problems/35631/10 "2003-11-16T07:53:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 7:56am UTC](https://forum.kirupa.com/t/score-problems/35631/11 "2003-11-16T07:56:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 8:01am UTC](https://forum.kirupa.com/t/score-problems/35631/12 "2003-11-16T08:01:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 8:03am UTC](https://forum.kirupa.com/t/score-problems/35631/13 "2003-11-16T08:03:02Z")

</div>

Thanks :thumb:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 8:05am UTC](https://forum.kirupa.com/t/score-problems/35631/14 "2003-11-16T08:05:01Z")

</div>

No problem. :beam:
