<mx:CurrencyFormatter>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:CurrencyFormatter alignSymbol="left|right" currencySymbol="$" decimalSeparatorFrom="." decimalSeparatorTo="." precision="-1" rounding="none|up|down|nearest" thousandsSeparatorFrom="," thousandsSeparatorTo="," useNegativeSign="true|false" useThousandsSeparator="true|false" />]]>
如果出现错误,则会返回一个空 String,以及一个说明已将此错误保存到
例如,您可以为 SwitchSymbolFormatter 类指定以下信息:
格式 String:“The SocialSecurity number is: ###-##-####”
输入 String:“123456789”
SwitchSymbolFormatter 类会分析格式 String,并使用输入 String 中的数字按照在输入 String 中指定的顺序替换每个占位符(默认情况下即数字字符 (#))。您可以定义不同的占位符元件,在实例化 SwitchSymbolFormatter 对象时将该元件传递给构造函数即可。
SwitchSymbolFormatter 类将使用这两个字符串创建如下输出 String:
“The SocialSecurity number is: 123-45-6789”
此模式中可以包含任何字符,只要它们在 String 数值部分的所有值中保持一致即可。但是,要格式化的值必须是数字。
源值中提供的位数必须符合模式 String 中定义的位数。这可通过调用 SwitchSymbolFormatter 对象的脚本实现。
<mx:NumberFormatter>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:NumberFormatter decimalSeparatorFrom="." decimalSeparatorTo="." precision="-1" rounding="none|up|down|nearest" thousandsSeparatorFrom="," thousandsSeparatorTo="," useNegativeSign="true|false" useThousandsSeparator="true|false"/>]]>
如果同时使用
如果出现错误,则会返回一个空 String,以及一个说明已将该错误保存到
设置此属性时,请确保
设置此属性时,请确保
在 ActionScript 中,您可以使用下列常量来设置此属性:
设置此属性时,请确保
设置此属性时,请确保
<mx:DateFormatter>
tag
to render date and time Strings from a Date object.
The <mx:DateFormatter>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:DateFormatter formatString="Y|M|D|A|E|H|J|K|L|N|S|Q" />]]>
如果出现错误,则会返回一个空 String,以及一个说明已将该错误保存到
var myDate:Date = DateFormatter.parseDateString("2009-12-02 23:45:30");
使用特定的大写字母组成模式 String,如 YYYY/MM。
DateFormatter 模式 String 既可以包含模式字母,也可以包含其他文本。要形成有效的模式 String,只需要一个模式字母。
下表描述了有效的模式字母:
示例:
示例:
示例:
示例:
示例:
<mx:PhoneFormatter>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:PhoneFormatter areaCode="-1" areaCodeFormat="(###)" formatString="(###) ###-####" validPatternChars="+()#-. " />]]>
为美国的七位数字格式提供快捷方式。如果
如果出现错误,则会返回一个空 String,以及一个说明已将此错误保存到
<mx:ZipCodeFormatter>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:ZipCodeFormatter formatString="#####|#####-####|### ###" />]]>
必须为六位数字的号码提供一个六位数字的掩码。如果您使用五位数字或九位数字的掩码,则可以设置五位数字或九位数字号码的格式。
如果出现错误,则会返回一个空 String,以及一个说明已将此错误保存到
<mx:tagname Properties error="" />]]>
在下列情形中分派此事件:设置 ResourceManager 的
子类应覆盖此方法,并在调用
子类必须在