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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:31:30+00:00 2026-05-28T04:31:30+00:00

In actionscript 3, I have a user enter a number into a field and

  • 0

In actionscript 3, I have a user enter a number into a field and this field is supposed to be for a cash value. How do I make it so that if for some reason they put say 20.956, it would round up to 20.96?

  • 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-28T04:31:31+00:00Added an answer on May 28, 2026 at 4:31 am

    You could use toFixed(). Something like:

    var cash:String = (Number("1.2365")).toFixed(2)
    

    It’s not mentioned in the documetnation, but i’m fairly sure it rounds rather than floors.

    Notice that .toFixed() returns a string, if you want a more comprehensive helper then you could use something like the following.

        public function rounder(num:Number, decimalPlaces:int, method:Function = null):Number {
            if(method == null) method = Math.round;
            var mul:Number = Math.pow(10,decimalPlaces);
            return method(num * mul)/mul;
        }
    

    and invoke it using:

    rounder(1.245, 2); // returns 1.25  (it uses round by default)
    rounder(1.245, 2, Math.floor); // returns 1.24
    rounder(1.241, 2, Math.ceil); // returns 1.25
    

    And actually you can use negative numbers for the decimalPlaces as well

    rounder(2123, -1, Math.ceil); // returns 2130
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does Actionscript have a built-in function that accepts a number and can return a
I have an ActionScript 2.0 file that contains a small library. This library parses
In Actionscript you can have global variables like this: var number : Number =
I have an actionscript file that defines a class that I would like to
I have written an ActionScript client program that tries to connect to a local
We have an application in which the user has to enter a date who's
i have used this code in my index.php to get user facebook first name
I have a working s3 uploader in actionscript that uses the FileReference class so
I have a project that was written using ACtionScript 3 in the Flash Builder
I have two flash movies fl_base and fl_top . fl_base contains ActionScript that pulls

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.