Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to do a AS3 Score Counter with multiple Scenes

Community Beginner ,
Jun 03, 2013 Jun 03, 2013

I've created an online quiz that tells you how many days you'll last if cats take over the world.  If you want to try it, here's the link:

http://www.curtisjenkinsportfolio.com/Cat%20Take%20Over.html

However, I can't get the action script to properly count up the number of days you'll last.  I've found plenty of advice for creating a counter, but they always reset at the end of the scene.  Since each question is it's own scene, I need the counter to continue throughout the entire project.  Can anyone help?

TOPICS
ActionScript
1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 03, 2013 Jun 03, 2013

if you create a variable that's not a reference to an on-stage object, it will not reset when scenes change.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 03, 2013 Jun 03, 2013

Wow, that brought me down a rabbit hole.  Now I'm having a really hard time creating any kind of counter without having to know quite a bit of coding.  Any ideas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 03, 2013 Jun 03, 2013
LATEST

// execute once to create your counter and initialize its value.

var counter:int = 0;

//everytime you want to increment your counter, use:

counter++;

//everytime you want to decrement your counter, use:

counter--;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines