Did you know?

Some formatting options may not be so obvious. These work-arounds come from my teammate, Nick Watson, in the U.K. I thought I’d share them with you.

The CurrencyFormatter does not supply leading zeros to values less than 1. For example, when you format the value 0.45 you get $.45 and not $0.45. There is no options on the CurrencyFormatter to add or supress leading zeroes.

The work-around is to change the decimalSeparatorTo property of the CurrencyFormatter. Here’s a class which extends CurrencyFormatter and overrides the format function:

import mx.formatters.CurrencyFormatter;

public class LeadingZeroCurrencyFormatter extends CurrencyFormatter
public function LeadingZeroCurrencyFormatter()
override public function format(value:Object):String
var n:Number = Number(value);
if( Math.abs(n) < 1 ) decimalSeparatorTo = "0.";
else decimalSeparatorTo = ".";

return super.format(value);


If you need to format Dates you might want to look at the DateBase class:

First of all, if you need to know the names of the months or days of the week, you don’t have to code them yourself. DateBase.monthNamesLong is a static property and you can use the values in your application. Having all of the month names in one location makes it that much easier to change them.

Secondly, if you want to change the names to another language, simply replace this Array with new values:

DateBase.monthNamesShort =["Ene","Feb","Mar","Abr","May","Jun","Jul","MyMonth","Sep","Oct","Nov","Dic"];

Now any DateFormatter calls you make will use these new values for the short month names.