Another Flash Q
- Started
- Last post
- 21 Responses
- Fher
Pals, sorry for the q but anyone knows how to transform a number to a decimal number? i.e. 1 to 01
Thanks in advance! Best regards!
- anon0
dec2bin()
- Fher0
no clue pal... doesn´t work
- Fariska0
If you need to use it as string convert to string and then ad the "0" in front of it, if it has just one digit.
Look for
Number.toString()
in the AS Language reference, you can convert it in many ways.
- anon0
- anon0
fariska, read the question.
- Fariska0
???
1 and 01 are the same numbers in the decimal system? Or I'am missing something?
- Fher0
No, i just want to convert 1 to 01, 2 to 02, 3 to 03 but not 30 to 030...
- anon0
haha, sorry fariska, i've been wrong all along. you're right. fher do what fariska sez.
- Fariska0
Ahahaha. I was wandering what strange meanings has the word decimal in english Glad to see that is the same in italian :-)
- Epictive0
1 / 100 = .01
20 / 100 = .2
Etc.Is that what you are asking?
- Fher0
No, i want to add a 0 to numbers smaller than 10...
"1" to be converted to "01"
but
"20" must remain "20"No such funktion on flash?
- UndoUndo0
I know what you want to do and you need to convert it to a string because 01 is not a number.
so if x is yr var
if(x
- UndoUndo0
NT scrubbed the code.
replace all [ with (
if[x
- Fariska0
Fher, you don't need to add a 0 to the numbers for math operations.
I guess you need that these values have an output on a dinamic text field right?
So you need to convert them in strings, adding the 0 in front of the value. In my previous post i had explained which method use.
- UndoUndo0
pffft
- Fariska0
http://livedocs.macromedia.com/f…
here is the how to
- UndoUndo0
sorry fariska didnt mean to pffft at you. your right he needs to convert to a string because 01 is not really a number
- Epictive0
Then do this:
function getFormattedNumber(n:Number):Str... {
var f = n.toString();
if (n
- Epictive0
Ah fuck, code here:
http://www.aaronclinger.com/drop…
- Fariska0
sorry fariska didnt mean to pffft at you.
UndoUndo
(Jul 19 05, 08:17)Too late, you're now on my ignore list.
;-p