Flex中的DateChooser组件,默认情况下是英文的。如何显示为中文信息呢。
其实很简单,这里介绍三种方式进行处理:
1,直接设置属性:
源代码如下:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns:ri="AAA.test.*" >
<mx:DateChooser dayNames="[日,一,二,三,四,五,六]"
monthNames="[一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月]" />
</mx:Application>
2,通过子标签进行设置:
<mx:DateChooser >
<mx:DateField dayNames="[日,一,二,三,四,五,六]"
monthNames="[一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月]" />
</mx:DateChooser >
3,通过AS3程序进行控制
<mx:Script>
<![CDATA[
<![CDATA[
function initDC(){
//myDate.dayNames=["日","一","二","三","四","五","六"];
myDate.monthNames=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"];
}
]]>
</mx:Script>
然后在DateChooser控件中增加一个初始化事件,如下:
<mx:DateChooser initialize="initDC()">