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 6662451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:23:27+00:00 2026-05-26T02:23:27+00:00

I have this frame-based counter I use instead of the timer-class because everything in

  • 0

I have this frame-based counter I use instead of the timer-class because everything in my game is frame-based. This counter ensures that everything runs fine even when used on old computers.

I would like to know if it makes sense to create a tenth-second-frame-based-counter (or even a twentieth-second-frame-based counter). Basically it would be nearly the same counter like the one below except for the fact that the framesPerSecond-variable is divided by 10 or 20 and instead of using seconds I use tenthsesonds or twentiethseconds.

Is that a good or bad idea? Is there basically a difference between frame-based counters and timers when used on old computers?
I’m not sure about this topic therefore I ask.

{
import flash.events.*;


public class BasicFrameTimer extends EventDispatcher
{
    public static const TIME_IS_UP:String = "timesup";
    public var countUp:Boolean = false;
    public var min:int = 0;
    public var max:int;
    public var maxSet:Boolean = false;
    public var seconds:int;
    private var frameCount:int;
    public var started:Boolean = false;
    private var framesPerSecond:int;

    public function BasicFrameTimer(framesPerSecond:int) {
        this.framesPerSecond = framesPerSecond;

    }

    public function start():void {
        frameCount = 0;
        started = true;
    }

    public function stop():void {
        started = false;
    }

    public function reset():void {
        if (countUp) {
            seconds = 0;
        } else {
            seconds = max;
        }
    }

    public function update():void {

        if (started) {
            frameCount++;
            if (frameCount > (framesPerSecond)) {
                frameCount = 0;

                if (countUp) {
                    seconds++;

                    if (maxSet == true && seconds == max) {
                        stop();
                        dispatchEvent(new Event(TIME_IS_UP));
                    }
                } else {
                    seconds--;
                    if (seconds == min) {
                        stop();
                        dispatchEvent(new Event(TIME_IS_UP));
                    }
                }
            }

        }


    }

}
}
  • 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-26T02:23:28+00:00Added an answer on May 26, 2026 at 2:23 am

    There is a difference between a Timer and using a frame event with implications for how the stage is updated, not just on old computers.

    You can set the suggested frames-per-second settings as part of the .fla file, and the compiled .swf will do its best to keep up with the suggested setting. If it can’t, it starts skipping frames to keep up.

    If you’ve defined some interactions, such as an animation, to happen on frame events, or via a frame counter, they will execute with the frames, meaning that a higher fps will cause a faster animation. If, instead, the animation relies on a timer, they will execute along with the timer.

    Executing with a timer will preserve real-time interactions at the cost of some choppiness for animations. A good way to test that you’ve correctly implemented a timer for an update cycle is to bump the fps down to 1 or 2 and see if the animation completes within the same amount of time (±1s).

    As you’ve tagged game-development, I’d recommend using a combination.

    A cycle using Timer should be used to check input, load resources and check game state (input, load, update)

    A cycle using ENTER_FRAME should be used to modify drawable assets (render)

    A cycle using EXIT_FRAME should be used to unload resources (unload);

    The reason for the combination is that you’ll be able to perform the simple calculations on a regular time interval, but you wont waste time with any rendering-specific logic until rendering is actually necessary. Additionally, it will allow your time-critical assets to stay in sync even on slow machines.

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

Sidebar

Related Questions

I have a data.frame in R that looks like this: score rms template aln_id
I have a data frame in R that looks like this: > TimeOffset, Source,
I have a UIImageView based class. At the start of this class, I have
I have a UIView class that I am using to have a CALayer. This
I have a Property File like this: frame.server.dev=mark.is.cool frame.server.test=chris.is.cool frame.server.qa=mitch.is.cool frame.server.prod=cory.is.cool I need to
I have this code <html> <head> <style type=text/css> .frame {width: 50em; border: 1px solid
I have a data.frame from this code: my_df = data.frame(read_time = c(2010-02-15, 2010-02-15, 2010-02-16,
I have a data frame with gaps like this: Var1 Var2 Var3 1 NA
I have a dataframe with numeric entries like this one test <- data.frame(x =
Suppose I have a dataframe like this one: df <- data.frame (id = c(a,

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.