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

  • SEARCH
  • Home
  • 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 4000820
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:49:44+00:00 2026-05-20T07:49:44+00:00

I have a result screen that shows bonus points and such. I want each

  • 0

I have a result screen that shows bonus points and such. I want each text field to increment one after another and also have it increment by a certain amount each frame.

Result Screen pops up.

First is the player score
check the player score, is it more than the score we want to display

if the player score is greater than the player display score by 100
increase the player display score by 100

if the player score is greater than the player display score by 10
increase the player display score by 10

else increase the player display score by 1

when finished move to the next score…and so on.

I have thought of using timers to move from one score to the next, but not being in an Event.ENTER_FRAME it only does one if then moves to the next one. Also the if statement for incrementing the score looks ridiculous and I’m thinking there has to be a better way to do it. I was thinking of making it a separate function but then I wouldn’t know what to return, or how to return it so it looks like its increasing and not just showing the total number instantly.

If you have any questions please leave a comment. I’ll try to expand on it a little more.

  • 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-20T07:49:44+00:00Added an answer on May 20, 2026 at 7:49 am

    You could make a new ScoreText class that inherits from TextField, and use that for each of your score text fields. On that class you could make a setTargetScore method that takes a score number, and handles the incrementation of the display number. Then it could dispatch an event when it is finished. You could listen for then events, and call the setTargetScore method on each ScoreText as you need to.

    Another way, that is possibly better/easier, is to use TweenLite to tween your score number, and use its events to update the score textfield, and when its complete, move to the next one.

    EDIT*

    Here is an example of using Tweenlite to tween a score variable:
    How to Tween A Variable with Flash and TweenLite

    EDIT2*

    Here is an example of my first method:

    First here is the ScoreText class:

    package {
        import flash.events.Event;
        import flash.text.TextField;
    
        public class ScoreText extends TextField {
            public static const EVENT_SCORE_COMPLETE:String = 'scoreCompleteEvent';
    
            private var targetScore:Number = 0;
            private var currentScore:Number = 0;
            private const speed:Number = 0.11;
    
            public function ScoreText(initialScore:Number = 0) {
                currentScore = initialScore;
                updateScore();
            }
    
            public function setTargetScore(targetScore:Number):void {
                this.targetScore = targetScore;
                addEventListener(Event.ENTER_FRAME, enterFrameHandler);
            }
    
            private function enterFrameHandler(e:Event):void {
                currentScore += (targetScore - currentScore) * speed;
    
                if (currentScore >= targetScore -1) {
                    removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
                    dispatchEvent(new Event(EVENT_SCORE_COMPLETE));
                }
    
                updateScore();
            }
    
            private function updateScore():void {
                this.text = Math.round(currentScore).toString();
            }
        }
    }
    

    And here is the Main class:

    package 
    {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.text.TextField;
    
        public class Main extends Sprite 
        {
            private var st1:ScoreText;
            private var st2:ScoreText;
            private var st3:ScoreText;
    
            public function Main():void 
            {
                if (stage) init();
                else addEventListener(Event.ADDED_TO_STAGE, init);
            }
    
            private function init(e:Event = null):void 
            {
                removeEventListener(Event.ADDED_TO_STAGE, init);
    
                st1 = new ScoreText(0);
                st1.y = 10;
                st1.addEventListener(ScoreText.EVENT_SCORE_COMPLETE, score1Complete);
                addChild(st1);
    
                st2 = new ScoreText(0);
                st2.y = 60;
                st2.addEventListener(ScoreText.EVENT_SCORE_COMPLETE, score2Complete);
                addChild(st2);
    
                st3 = new ScoreText(0);
                st3.y = 110;
                st3.addEventListener(ScoreText.EVENT_SCORE_COMPLETE, score3Complete);
                addChild(st3);
    
                st1.setTargetScore(1234);
            }
    
            private function score1Complete(e:Event):void 
            {
                trace('score 1 finishes, start the next one!');
                st2.setTargetScore(234553);
            }
    
            private function score2Complete(e:Event):void 
            {
                trace('score 2 finishes, start the next one!');
                st3.setTargetScore(745);
            }
    
            private function score3Complete(e:Event):void 
            {
                trace('score 3 finishes, start the next one!');
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the result of one API (FourSquare) giving me this.. [[4e01728f814d9dac7d52b93d,Bark Boutique,40.7143528,-74.0059731],[4d9f92dfaffda35d5db2a748,Bark Boutique,40.7143528,-74.0059731]]
I have a Result object that lets me pass around a List of event
I have a result of a db query in java.sql.ResultSet that needs to be
Let's imagine that I have a result of evaluating XPath expression //node/@*. MSXML6 returns
I have an IQ test result which ranges from 40 to 180 and that
i have a JFrame that contain a JButton when JFrame shows up, user will
I Have activity that get some data from the internet, and shows it to
Ok, So I have an Image object that I want to rotate around its
I have a search results screen and in the results payload supplied I get
I have a result of a query which has BLOB column defined in it.

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.