Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | RE: [flasher] RE: number -> currency |
From: | jwoodw - Jeffrey Woodward |
Date: | Mon, 12 Feb 2001 15:52:49 -0000 |
Cool! I hadn't taken the effort to try and convert it to Flash 5 yet...
Thank you too!
Jeff
-----Original Message-----
From: Patrick McNeil [pmcneilsonacomis [dot] com (mailto:pmcneilsonacomis [dot] com)]
Sent: Monday, February 12, 2001 9:20 AM
To: flasher from chinwag
Subject: [flasher] RE: number -> currency
groovy,
I changed it for flash 5, but didn't use a function so that it can be
published as flash 4
// Comma Parser, just pass in variable "input", and use returned variable
"formatted"
formatted = "";
i = 0;
while (i < length (math.floor(input)) -1) {
formatted = substring ( input, length (math.floor(input)) - i, 1) add
formatted;
temp = math.floor ((i+1)/3);
temp2 = (i+1)/3;
if (temp == temp2) {
formatted = "," add formatted;
}
i = i + 1;
}
formatted = substring (math.floor(input), 1, 1) add formatted;
formatted = "$" add formatted;
Thanks for the help
-----Original Message-----
From: jwoodw - Jeffrey Woodward [jwoodwacxiom [dot] com (mailto:jwoodwacxiom [dot] com)]
Sent: Friday, February 09, 2001 2:15 PM
To: flasher from chinwag
Subject: [flasher] RE: number -> currency
Here's some Flash 4 number formatting code I wrote (with the great help of a
programmer friend and lots o' folks on this list) sometime last year. It's
been too long since I've revisited it, so I don't know for sure if I could
adequately explain how it works, but I use it like a function. I put the
code in a frame labeled "commaParser" and whenever I have a number variable
defined as "input" that I needed to format, I just do a Call("commaParser")
and it returns the variable "formatted". I hope it helps!
Here's the code:
Set Variable: "subInput" = (input - Int (input) + .005) * 100
Set Variable: "subInput2" = Int (subInput) / 100
Set Variable: "formatted" = ""
Set Variable: "i" = 0
Loop While (i < length (Int (input)) - 1)
Set Variable: "formatted" = Substring (input, length (Int (input)) -
i, 1) & formatted
If (Int ((i + 1) / 3) = (i + 1)/3)
Set Variable: "formatted" = "," & formatted
End If
Set Variable: "i" = i + 1
End Loop
Set Variable: "formatted" = Substring (Int (input), 1, 1) & formatted
If (length (subinput2) = 3)
Set Variable: "formatted" = formatted & Substring (subInput2, 2, 3) &
"0"
Else
Set Variable: "formatted" = formatted & Substring (subInput2, 2, 3)
End If
Good luck with your project!
Jeff
-----Original Message-----
From: Patrick McNeil [pmcneilsonacomis [dot] com (mailto:pmcneilsonacomis [dot] com)]
Sent: Friday, February 09, 2001 12:19 PM
To: flasher from chinwag
Subject: [flasher] number -> currency
I need to format a bunch of numbers that are imported as currency. ie, add
the $ and commas. Is their a function in flash to format numbers? I havn't
found one but thought I might just be over looking it. If not, any tutorials
on doing it. I just don't feel like figuring the code out if I don't have
to...Thanks for the help...
Patrick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Chinwag site carries a wealth of Flash resources.
Find useful links, suggested reading and archives at:
** http://www.chinwag.com/flasher **
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You are subscribed to flasher as: jwoodwacxiom [dot] com
To unsubscribe, email leave-flasher-479018Glists [dot] chinwag [dot] com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Chinwag site carries a wealth of Flash resources.
Find useful links, suggested reading and archives at:
** http://www.chinwag.com/flasher **
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You are subscribed to flasher as: pmcneilsonacomis [dot] com
To unsubscribe, email leave-flasher-479018Glists [dot] chinwag [dot] com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Chinwag site carries a wealth of Flash resources.
Find useful links, suggested reading and archives at:
** http://www.chinwag.com/flasher **
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You are subscribed to flasher as: jwoodwacxiom [dot] com
To unsubscribe, email leave-flasher-479018Glists [dot] chinwag [dot] com
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]