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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:45:35+00:00 2026-05-14T07:45:35+00:00

How can I set my countdown correctly? I’m counting from 33,000.00 to zero. It

  • 0

How can I set my countdown correctly?

I’m counting from 33,000.00 to zero. It works in a fashion, but the minus operator appears in the textfield.

//Countdown from 33,000.00 to zero
var timer:Timer = new Timer(10);  
var count:int = -3300000; 
var fcount:int = 0; 
timer.addEventListener(TimerEvent.TIMER, incrementCounter);  
timer.start();   
function incrementCounter(event:TimerEvent) {  
count++;  
fcount=int(count);
mytext.text = formatCount(fcount);
}
function formatCount(i:int):String { 
var fraction:int = i % 100; 
var whole:int = i / 100;  
return ("0000000" + whole).substr(-7, 7) + "." + (fraction < 10 ? "0" + fraction : fraction); 
} 

alt text http://www.ashcraftband.com/myspace/videodnd/nm___.jpg


EXAMPLE
I need something I can update with XML, to be an up-counter or down-counter depending on the variables.

//Count up from 33,000.00
var countValue:int = 3300000;
count = countValue;

//Count down from 33,000.00
var countValue:int = -3300000;
count = countValue;

This is all I needed
fcount = Math.abs(count)

  • 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-14T07:45:35+00:00Added an answer on May 14, 2026 at 7:45 am

    To get rid of the minus sign:

    // Absolute value of i will be calculated in abs_i.
    var abs_i:int = i;
    if (abs_i < 0)
        abs_i = -abs_i;
    
    var fraction:int = abs_i % 100; 
    var whole:int = abs_i / 100;
    

    To handle the case where you wish to count up, you will have to do things a bit differently. It would be better to have two functions, including a new function named decrementCounter. If you like, there can be an event handler which uses an if (counter < 0) to determine which should be called.

    EDIT: On re-reading your code it seems you intended

    fcount=int(count)
    

    might solve your problem, but you could call

    fcount = Math.abs(count)
    

    and then your “formatted count” would always be a positive value. Then you could ignore the changes I recommended originally, above.

    (You don’t need to call int() because count is already of type int, as is fcount.)

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

Sidebar

Related Questions

I can set fixed height in pixels, but i'd like to set it in
I can set up an autofilter using pyWin32, but I wondered if it's possible
I am working with a countdown timer and have it set so that it
How can set the flag to set the condition of displaying a message only
How can I set line spacing with CSS, like we can set it in
In Dashcode you can set up a handler for a behavior in the inspector.
I do get that we easily can set the Close button text to a
In my app a user can set the status of a Post to different
Let's say by using jQuery I can set the width of a DIV doing
Hi All Nightowls out there :), I need to authenticate username and password provided

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.