Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6071003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:59:52+00:00 2026-05-23T09:59:52+00:00

I have genuinely, genuinely looked ALL over the web for a basic scoring system

  • 0

I have genuinely, genuinely looked ALL over the web for a basic scoring system and can’t find one that actually works. Maybe it’s just me/ my game but nothing works.
I’m trying to do it with a dynamic text box. So i’ve got a starting score.
But when i put: “Score = Score + 10;”
Nothing happens. So yeah, any help please. I’m gonna put up most of the game code, to see if it’s something else, and there’s only ~ 30 lines…I want it so when the two objects collide the score goes up. THANKS
Oh and I embedded the text, after flash told me to. Hence the first line ↓.

import flash.text.*;
import flash.display.*;
import flash.events.*;
import flash.ui.Keyboard;
import flash.text.TextField;

var pressedKeys:Object = {}; 

// BASIC KEYBOARD MOVEMENT - Took it out as it is almost defs irrelevant.


var Score = 10 
var myText:TextField = new TextField();
addChild(myText);
myText.text = ("Score:"+ Score);
myText.textColor = 0xFF0000;
myText.border = true;
myText.height = 20;
myText.x = 4;
myText.y = 4;

addEventListener(Event.ENTER_FRAME, hitTest)
function hitTest(e:Event):void
{
    if(Hero_Mc.hitTestObject(Enemy_mc)&& (Enemy_mc.width<Hero_Mc.width))
   {
      Hero_Mc.width=Hero_Mc.width +4;
      Hero_Mc.height=Hero_Mc.height +4;
      Enemy_mc.stop();
        removeChild(Enemy_mc);
        addChild(Enemy_mc);
        Enemy_mc.x= Math.floor(Math.random()*500);
        Enemy_mc.y= Math.floor(Math.random()*350);
        Score = Score + 10;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:59:52+00:00Added an answer on May 23, 2026 at 9:59 am

    Nothing changes because myText.text only receives the value of Score, not the actual reference. You can either use BindingUtils. Or, you can change the following line:

    var Score = 10;
    

    to

    private var _score = 10;
    protected function set Score(value:Number):void {
        _score = value;
        //Now, whenever you set Score to anything, it also sets the text on myText.
        myText.text = ("Score:"+ Score);
    }
    
    protected function get Score():Number {
        return _score;
    }
    

    Also, I agree with citizen. ActionScript convention is to use lowercase variables and _prefixed for private vars.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that appends some rows to a table. One of the
I have a new web app that is packaged as a WAR as part
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have a n-tire web application and search often times out after 30 secs. How
I have a developer on my staff that chronically overshoots deadlines, and estimates. On
Why would anyone prefer Scheme macros over Common Lisp macros (and I genuinely want
I'm trying to think of how to validate that a web service is only
I have a project that adds elements to an AutoCad drawing. I noticed that
I have a basic ASP.Net project created in Visual Studio 2008 on Windows Server
I have genuine Windows 7 Home Basic on my Dell laptop. However IIS isn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.