# Keeping Score with Dynamic Text + If

**URL:** <https://forum.kirupa.com/t/keeping-score-with-dynamic-text-if/18204>\
**Category:** flash\
**Created:** [April 14, 2003, 2:15pm UTC](https://forum.kirupa.com/t/keeping-score-with-dynamic-text-if/18204 "2003-04-14T14:15:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Llama\_Lord](https://avatars.discourse-cdn.com/v4/letter/l/a698b9/32.png) [@Llama\_Lord](https://forum.kirupa.com/u/Llama_Lord)\
**Post date:** [April 14, 2003, 2:15pm UTC](https://forum.kirupa.com/t/keeping-score-with-dynamic-text-if/18204/1 "2003-04-14T14:15:26Z")

</div>

I’m trying to create a game for a class project, using Flash MX. Unfortunatly, I am unable to figure out how to goto a new scene when the score reaches a certain number.

The ActionScript for it is…:  
//hit  
\_root.total = \_root.total + 100  
//miss  
\_root.total = \_root.total - 50

I’ve tried…

* * *

if (\_target.score \>= “100”  
gotoAndStop("Scene 2, “1”)  
}else (\_target.score \<= “-100”  
gotoAndStop("Scene 2, “2”)

* * *

if (this.score \>= “100”  
gotoAndStop("Scene 2, “1”)  
}else (this.score \<= “-100”  
gotoAndStop("Scene 2, “2”)

* * *

if (score \>= “100”  
gotoAndStop("Scene 2, “1”)  
}else (score \<= “-100”  
gotoAndStop("Scene 2, “2”)

* * *

I’ve even tried using “”'s around ‘score’ and other things, but still no luck. I still havn’t figured out the stupid timer either…

If anyone can give some advice, I’d apreciate it greatly!

Thanks

---

<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:** [April 14, 2003, 2:31pm UTC](https://forum.kirupa.com/t/keeping-score-with-dynamic-text-if/18204/2 "2003-04-14T14:31:00Z")

</div>

you dont need "'s around the 100. But you need it around the scene number. See if this works:

[AS]  
if (\_root.score\>=100) {  
gotoAndPlay(“Scene 2”, 1);  
}  
if (\_root.score\<=-100) {  
gotoAndPlay(“Scene 2”, 2);  
}  
[/AS]

that should work, but i havn’t tested it. Tell me if it does or doesn’t 🙂

---

<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:** [April 15, 2003, 11:54am UTC](https://forum.kirupa.com/t/keeping-score-with-dynamic-text-if/18204/3 "2003-04-15T11:54:19Z")

</div>

No luck with that either – Thanks for trying though.

---

<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:** [April 15, 2003, 12:39pm UTC](https://forum.kirupa.com/t/keeping-score-with-dynamic-text-if/18204/4 "2003-04-15T12:39:15Z")

</div>

## Today I’ve also tried a few other things with no luck…

Winner = (\_root.score \>= 100)  
Loser = (\_root.score \<= -100)

## if (winner) { gotoAndStop (“Win”, “1”); }else if (loser) gotoAndStop (“Lose”, “1”); }

X \>= 100  
Y \<= -100

## if (\_root.score = X) { gotoAndStop (“Win”, “1”); }else if (\_root.score = Y) { gotoAndStop (“Lose”, “1”); }

… I’m beginning to think it isn’t possible.

---

<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:** [April 15, 2003, 2:07pm UTC](https://forum.kirupa.com/t/keeping-score-with-dynamic-text-if/18204/5 "2003-04-15T14:07:03Z")

</div>

Can i have a look at your fla?

in the meantime try this:

[AS]  
if (\_root.score\>=100) {  
\_root.gotoAndPlay(“Scene 2”, 1);  
}  
if (\_root.score\<=-100) {  
\_root.gotoAndPlay(“Scene 2”, 2);  
}  
[/AS]

---

<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:** [April 16, 2003, 2:29pm UTC](https://forum.kirupa.com/t/keeping-score-with-dynamic-text-if/18204/6 "2003-04-16T14:29:39Z")

</div>

Thinking about it… I can just make the score manually. And have a miss move the score (movie clip), move to a previous frame.

Thanks a lot for the suggestions though.
