Chapter 41 Example 4
♥0 |
Line 21 |
Modified 2010-02-10 08:34:31 |
MIT License
archived:2017-03-20 03:51:53
ActionScript3 source code
/**
* Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/nAG6
*/
package {
import com.actionscriptbible.Example;
import flash.globalization.*;
public class ch41ex4 extends Example {
public function ch41ex4() {
var local:CurrencyFormatter = new CurrencyFormatter(LocaleID.DEFAULT);
trace(local.format(123456.78)); //USD123,456.78
var usa:CurrencyFormatter = new CurrencyFormatter("en-US");
trace(usa.format(123456.78, true)); //$123,456.78
var jp:CurrencyFormatter = new CurrencyFormatter("ja-JP");
trace(jp.format(123456.78, true)); //¥123,457
var de:CurrencyFormatter = new CurrencyFormatter("de-DE");
trace (de.format(123456.78, true)); //123.456,78 €
var fr:CurrencyFormatter = new CurrencyFormatter("fr-FR");
trace (fr.format(123456.78, true)); //123 456,78 €
var localeID:LocaleID = new LocaleID(local.actualLocaleIDName);
trace("Local currency in " + localeID.getRegion() + ": " +
local.currencyISOCode + " (" + local.currencySymbol + ")");
}
}
}