Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: [flasher] RE: number -> currency
From: jwoodw - Jeffrey Woodward
Date: Fri, 09 Feb 2001 20:24:11 -0000

One other thing I forgot to mention... This was written to take numbers
with multiple places after the decimal point and convert them to "2" places
after the decimal with commas, so your application may require a little
modification...

Jeff


-----Original Message-----
From: jwoodw - Jeffrey Woodward [jwoodwatacxiom [dot] com (mailto:jwoodwatacxiom [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 [pmcneilatsonacomis [dot] com (mailto:pmcneilatsonacomis [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: jwoodwatacxiom [dot] com
To unsubscribe, email leave-flasher-479018Gatlists [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: jwoodwatacxiom [dot] com
To unsubscribe, email leave-flasher-479018Gatlists [dot] chinwag [dot] com



[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]