CurrencyFormatter in Flash

04:04 AS3 FLA 10

Act now while we have available seating

Our on line school is private, affordable and interactive with trainer support.
Act now save your seat before someone else takes yours.
Act now

What is the CurrencyFormatter?

The CurrencyFormatter class provides locale-sensitive formatting and parsing of currency values. The CurrencyFormatter class was introduced only in flash player 10.1+ thus if your running an older player version this might not be the right class for your need.

The CurrencyFormatter class uses the data and functionality provided by the operating system and is designed to format currency values according to the conventions of a specific locale and type of currency. The position of the currency symbol, the negative symbol, the decimal separator, the grouping separator, the grouping pattern decimal separator, and other elements can vary depending on the locale.

If the operating system supports the requested locale, the properties and currency type are set according to the conventions and defaults of the requested locale. If the requested locale is not available, then the properties are set according to a fallback or default system locale, which can be retrieved using the actualLocaleIDName property.

Due to the use of the user's settings, the use of formatting patterns provided by the operating system, and the use of a fallback locale when a requested locale is not supported, different users can see different formatting results, even when using the same locale ID.

The format

Working with the CurrencyFormatter is very easy. When creating the instance of your currencyformatter you need to pass one string that would let flash know what country and what language you want the currency to be formatted into(by the way the second parameter a non mandatory one enables you to select if you want the actual currency symbol to be used by default a 3 letter acronym of the currency would be displayed).

The format is very simple "aa_BB" - while the 'aa' part is the two letter that represent the language(en- for English, fr- for french and so forth) and the 'BB' part stands for the country code(US - united states, FR - France and so forth).

Many countries and regions use the same currency symbols for different currencies. For example the United States, Australia, New Zealand, Canada, and Mexico all use the same dollar sign symbol ($) for local currency values. When the formatting currency differs from the user's local currency it is best to use the ISO code as the currency string. You can use the formattingWithCurrencySymbolIsSafe() method to test whether the ISO code of the currency to be formatted matches the currencyISOCode property of the formatter.


Our free content is sponsored by these ads become a prime member and get rid of them.

Act now while we have available seating

Our on line school is private, affordable and interactive with trainer support.
Act now save your seat before someone else takes yours.
Act now