Decimal Places....
how do i determine the number of decimal places a user can key in in a input text box?
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 09-08-2004, 04:11 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Two Decimal Places Please.
Hello, is there a way to confine numbers in a dynamic text box to 2 decimal places rather than a whole long line of numbers?
Cheers - Turner2000
Decimal Places
can anybody tell me how i round a variable to a certain number of decimal places?
2 Decimal Places?
im doing a mathematical calc with variables and i want the answer displayed as £s. How can i ensure that there are two decimal places in the answer so that i dont get an answer of £9.5 etc
cheers
Decimal Places
hi,
how do i get a calculation to always return with the same number of deciaml places?.
eg
4.00
3.95
1.11
thx
Decimal Places
hi,
is there a way to get a calculation displayed always to the same decimal places?
ie
1.00
2.85
4.01
etc
thx
Decimal Places
Can anybody tell me how to limit the decimal places to 2 in the dyanamic text field? I have given a dynamic field a variable name. and I created a button to change its value by 0.1. But when I click the button the text box shows me many number of decimal places after a point. I want to limit it to 2 places
Thanks
Decimal Places
im kinda new to flash. Not really but theres a few things i dont know yet.
i dunno if its possible... i know it is in programming languages that are similar to actionscript so i thought it'd give it a shot. Anyway,
im doing some equations and stuff in the action script... like... to figure out the precentage of somehting. the 'thing' is out of 136. So theres 136 possibly points you can get...
Since its such a number, the equation will turn out with a bunch of decimal places
so im asking how i can make it so only one decimal point appears... like 55.3%
???
Please help
Thanks
Decimal Places
Hello!
I have a dynamic text which displays a number to however many decimal places it can fit in the text box. I'd like to make it show 2 decimal places, can anybody help?
Thanks you
2 Decimal Places, How?
I want to have a timer, in a game I'm creating.
I want the timer to be in seconds, with 2 decimals all the time! I.e. 41.10 sec. (not 41.1), or 7.00 (not 7). <-- was that an AND/OR error?
Well, how do I tell the "time-variable" to contain 2 decimals in every value?!
Decimal Places
hey how can i limit the number of decimal places displayed in an output of an equation? my code is for a preloader to show the percentage loaded but i don't want any decimal places...
onClipEvent (load) {
preload = " ";
}
onClipEvent (enterFrame) {
preload = _root.getBytesLoaded() / _root.getBytesTotal()*100 + "%";
if (_root.getBytesTotal() == _root.getBytesLoaded() ) {
preload = "done";
}
}
thanks guys
Only Two Decimal Places...
Hi, ive got a dynamic tetx box, and in each frame im adding 0.08 to it. But I only want it to show the number to 2 decimal places, can this be done?
Thanks for any help.
Decimal Places...
hello!
i've been given the task of creating an insurance/tax calculator for work despite the fact that i am not a programmer or have the slightest idea how to write code. anyways, after 2 long weeks i've managed to get it working but i'm stuck when i try to display decimal places. basically, i want the numbers to display 2 decimal places and a comma once it reaches the thousands, ex. 1,234.56. i've been searching these forums for some time now and the related threads i have found, i can't seem to make it work with the code i already have. please put me out of my misery by helping me out!!! any help is appreciated.
attached is my flash file.
Cut Decimal Places
Hi,
a perhaps basic question. I am getting some values of variables like 3.1, 3.7, 3.9 etc. Now I want to cut the decimal places to get 3 in this case. Or 2 for 2.0 to 2.9. How can I do this?
Thanks in advance
Decimal Places
hi,
This might sound stupid..
Does anybody kknow how to restrict the decimal places values in a number?
for example.... if iam doing something like:
var n;
n=100/3;
input.text=n;
In the input textfield i want only 33.33 to appear rather than 33.3333...is there any way to do this, rather than restricting the size of the textfield??
pls help!!!
Decimal Places
I have asked this before but I think Im a bit slow cos I still dont understand how it works?
on (release){
extras = ((options.abQty*25)+(options.dustQty*9.50) + (options.truckQty * 25) + (options.lightQty*15));
extras.text=extras;
dayVal = day.value;
DayVal = day.value;
rate = Math.ceil(DayVal/7);
costa = rate*storesize.selectedItem.data;
total.text=costa + extras + packingSO.selectedItem.data ;
}
I want total.text to contain a number with 2 decimal places this is a lot harder than I thought it would be? I thought there would just be an option or something like that?
Decimal Places
hi,
This might sound stupid..
Does anybody kknow how to restrict the decimal places values in a number?
for example.... if iam doing something like:
var n;
n=100/3;
input.text=n;
In the input textfield i want only 33.33 to appear rather than 33.3333...is there any way to do this, rather than restricting the size of the textfield??
pls help!!!
No Decimal Places (HOW)
Hi there... how do I make it so that my timer does not display the decimal places when it increments by .10? I only want to see whole numbers... thanks
Decimal Places
I've been working on my preloader and added a few more things to it:
* Time Passed
* Time Remaining
* Transfer Rate
Anyway, the time passed is fine because it goes up in seconds, but the transfer rate and time remaining have loads of numbers after the decimal point i.e. 71.434563323k
If I set them both as integers, they don't look very good, so I want to set them to 2dp, i.e. the number above would appear as 71.43k etc
Any help appreciated...
Aw yeah, before I forget, I use Flash 5.
Rgds
Truncating To Two Decimal Places
I've seen a post on here that says how to do it that says to convert the number into a string and then find out where the decimal is and have the actionscript delete the characters after the second decimal place but I dont know how to do that. The numbers vary from no decimal places to like 10 decimal places. If the outcome of a problem has no decimal places I would also need to add the ".00" Thanks
David
Decimal Places In Flash 5
Could someone help me on how do I display the value of a dynamic text field with 2 decimal places. Most of my variables deals with currency and I need to display the amount with 2 decimal places. thanks in advanced.
CONTROLLING DECIMAL PLACES?
Hi i made a preloader with by making actions like this:
onClipEvent (load) {
loa = _root.getBytesLoaded()/1000 + " kb " + "/" + _root.getBytesTotal()/1000 + " kb";
if (_root.getBytesLoaded()==_root.getBytesTotal()) {
loa = "DONE";
}
}
onClipEvent (load) {
per = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100 + "% COMPLETE" ;
if (_root.getBytesLoaded()==_root.getBytesTotal()) {
per = "DONE";
}
}
Now when i get the results in my dynamic text, the percent is like 18.5634452, 21.23413414... How can i get the number to go to two decimal places like 21.23.... Someone told me using math.floor or something but how would i use it????
Decimal Places Want 35.66 Not 35.666666666
Hi I'm sure this is a real no brainer for someone but its got a me a bit stumped.
I'm making something real simple that converts temperatures from farenheit to celcius and back again.
I get values that are like 34.5555555555 what i'd like to do is limit any value to 2 decimal places like 34.55 and so on.
I'm sure this can be done using some sort of string fucnction but the syntax in the flash help never helps me.
can anyone help?
How To Round To 4 Decimal Places
Hey everyone. I know how to round to nearest whole number, how to round up, how to round down, but I dont know how to round to a certain amount of decimal places..
I want to round a number like: 0.23112934039230
to: 0.2311
What is the actionscript to do that? Thanks.
Limiting Decimal Places ($4.10 Not $4.1)
I've only been working with flash a couple of months (self taught).
I'm trying to show $ amount totals in a dynamic text box in a SWF.
Everything works fine except occasionally the total equals a multiple of 10 cents.
$4.10 comes out $4.1
Is there any way to force flash to display 2 decimal places.
I checked "Actionscript fo Dummies" (my mentor) but there doesn't seem to be anything that addresses this issue.
http://www.joelkilgore.com/shoppingcart3.html
2 clicks on the third camera returns the result:2999.9
I need the result to be 2999.90
Dropping Decimal Places
I have built an application for my client that adds one decimal number with another. Example:
00.35
+
01.25
and the resulting number is 1.60 but I want to maintain all the decimal places so that the result is
01.60. What do I have to add to the equation to make this possible?
Thanks
Removing Decimal Places
I have a variable (inputNumber) that is displayed in a dynamic text box. Trouble is the variable can have many decimal places after it, and all I want are whole numbers. Is there a way to ensure all numbers are rounded up or down to whole numbers before being displayed?
Thanks!!
How Do I NOT Display Decimal Places If They Are 0?
I am trying to make a small enhancement to some code. I need to modify a number so that if the last decimal place is 0 then it wont display it.
10.00 would be 10
10.10 would be 10.1
10.11 would remail 10.11
I am setting the decimal places to 2 using
Code:
strNum = Math.formatDecimals(intNum, precision);
But what I really want is a method that will set the max number of decimal places to be 2, and when there are 0's that it wont display them.
Is there any easy way to do this?
Rounding Up Decimal Places
Hi guys,
I was playing around with Flash 8 last night and got bored and created this point system thing...
It's really basic,
Clicking one button raises the points of one character, the other button raises the points of another.
Clicking the difference button gives two numbers found by multiplying the numbers by.3
which then are subtracted to find the final number of points, which can be divided amongst attributes
(there is really no purpose behind this yet, although I'm sure I can find one...)
Right now I'm just trying to round up the differences and the distributal points because they always end in something like .999999 or .8888777 etc... If this is possible, any help would be appreciated.
I have also uploaded the fla.
Round To Two Decimal Places?
Hi everyone.
Ive been given the task to make a simple calculator.
Part of it is to make a fraction into a decimal. The ActionScript I've got so far is:
Code:
on (release) {
ans2=""
ans = Number(num)/Number(den)
}
I know that you can round numbers using
Code:
ans = Math.round(ans)
but I'm wondering if there is a script that can set the answer to two decimal places?
Thanks, Tim
Showing Decimal Places
Perhaps silly question.
I have some variables for which default values are 1.0000 or 0.0000. These are to be displayed in dynamic text boxes but come up as 1 or 0. Is there a graceful way to show the number with the decimal places?
Thanks
ActionScript Code:
var mutA:Number = 0.0000;
mutation.text = String(mutA);
Controlling Decimal Places
Does any one know if you can control the number of decimal places display when using code to generate dynamic text? I.e. 1.000 instead of 1
Math To 2 Decimal Places
Im thinkn' its around but I just cant search it...
Sooo....
What is the Math.???? for making a number always have 2 decimal places?
Im sorry if it's simple, I've had a rough day :c)
~~ Seretha
Rounding Up To 2 Decimal Places
hi all,
does anyone have or know of a simple sure fire way to round up a figure to 2 decimal places.
flash has a horible habbit of removing 0's.
I need to round up figures but having to split a number like 100.056 (fine when its a string, but not when its a number)
rounding up the 056 gets complicated as flash will see it as 56.
a class or function would be much appreciated.
Or would it be far easier and reliable to send the figures out of flash to php
:/
Decimal Places In Input Box
Hi all,
I'm using some input boxes to get the value as well as to display the numeric values...Now after the calculations the value shown in input box is something like 0.2875362... but i want to limit that to two decimal places...how to do that...someone please help...
-gaurav
Working With Decimal Places
Hey there
I have a Number type variable that is outputting as 3.46666666 I want it to round it up to 1 decimal place ie 3.6 so I can display it in a text field what do I do any ideas?
Recognising And Using Decimal Places
I have a question and answers widget that is to do with the hotel industry, so basically you get asked questions such as how many hotels, how many rooms etc and some of the questions such as how much does staff training cost is a number.
I would like to put in 250.00 as an amount and with all the other calculations I would liek that decimal place to be recognised and then in the final calculation that decimal point is displayed correctly, but it doesnt.
If there is a simple reason for this then great, but if you need screen schots, fla the action script then I can post that, but be great to have some help either way.
Thanks
Lee
Decimal Places In Flash MX
I am not sure how to bring numbers down to 2 decimal places. I have some simple code that states the calculation,
but "grandtotal" comes up as example... 37.335622
Anyone know how to bring the decimal place to 2?
this is the script....
grandtotal = Number (total2) / Number (grand);
thanks,
TD
Math To 2 Decimal Places
Im thinkn' its around but I just cant search it...
Sooo....
What is the Math.???? for making a number always have 2 decimal places?
Im sorry if it's simple, I've had a rough day :c)
~~ Seretha
Decimal Places In Flash
Probably a stupid question, but I honestly don't know how..
How do I set the number of decimal places in my variables? I'm writing a script that uses currency >> ie $210.34
help?
Formatting To 2 Decimal Places
hey all. i know this sounds stupid but i cant for the life of me figure out how to format my dynamic text fields for currency support, ie; xxx.yy. I could make a function to do it, searching for decimal points etc, but i'm sure there will eb a function that already does it somewhere in flash.
Anyone care to let me know what i have to do ?
I know this is simple.
Dave
How Do I Constrain A Counter To Two Decimal Places?
me very new to actionscritping i'm trying to create a counter so that i can show how long a simulation takes.
this is the code i have so far, but when it executes, it writes to multiple decimal places. eg 2.3999999
onClipEvent (load) {
counter = 00.00;
}
onClipEvent (enterFrame) {
counter += 00.01;
}
the frame rate is 100 fps.
i thought this would be logical seeing as though there are 100 milliseconds in a second, plus the enterframe command.
i'd prefer the counter to have no decimal places, just count like this....
00:22(secs)
00:23
00:24 etc...
but i can only acheive that with a frame rate of 1 fps
if someone could tell me what i'm doing wrong, or a more efficient way of doing this, please help.
thanks.
Rounding Numbers To 2 Decimal Places?
Hi all,
cam anyone remember how to calculate to 2 decimal places
ie
542.8688
to 2 decimal places would be
542.87
i can cut off the no required places but cant seem to round up or down accurately
any help greatfully appreciated
thanks in advance gilesb
How To Make A Number To 2 Decimal Places?
Please can someone tell me what script I need to use to limit the result of an onClipEvent calculation to 2 decimal places.
Thanks
(this is for a preloader telling the % loaded)
GetValue() Not Returning Decimal Places
hi,
i am trying to use getValue() to return the following values from a combobox:
thePrice = "£ "+Number(shipList.getValue()) /*".00 "*/;
the values for the combobox are 25.00, 27.50, 31.00
previously, i was working around the problem by adding .00 as a string. but now i have a value 27.50 in the shiplist dropdown. this will return either 27.5 or 27.5.00, depending on whether i include the concatenated zeros.
how can i convert the getValue() value to a number with two decimal places?
would appreciate a reply - i have only had one reply to four posts! please do a search on lukemack if you can help on other posts. i have replied myself to those i have solved.
thanks,
luke.
Limit Decimal Places For Currency?
I'm putting together an e-commerce site in flash and I need to limit the decimal places for currency on the shopping cart and checkout. How would I do this? Also, how would I put in additional zeros if needed? Any help is very appreciated, I can't figure this out for the life of me.
Thanks so much.
Steve
|