<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Style>
DateField {
cornerRadius: 4;
headerColors: #99cc99, #f4f5f7;
todayColor: #3366ff;
color: #669900;
borderColor: #333300;
fontSize: 12;
headerStyleName: "mydateChooserHeaderStyle"; weekDayStyleName: "mydateChooserWeekDayStyle";
}
.mydateChooserHeaderStyle {
color: #ff6600;
}
.mydateChooserWeekDayStyle {
color: #0000ff;
}
</mx:Style>
<!--格式化日期 和 时间-->
<mx:DateFormatter id="dateformat" formatString="YYYY-MM-DD"/>
<mx:DateFormatter id="format2" formatString="L:N:S"/>
<mx:DateField id="df" x="395" y="42" width="112" formatString="YYYY-MM-DD" dayNames="[日,一,二,三,四,五,六]" monthNames="[一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月]"/>
<mx:Button x="471.5" y="87" label="获得日期值" click="showTime()"/>
<mx:Script>
<![CDATA[
import com.yahoo.astra.mx.controls.TimeInput;//yahoo flex工具包
import mx.controls.Alert;
private function init():void{
input=new TimeInput();
input.x=df.x+120;
input.y=df.y;
input.value=new Date();
this.addChild(input);
//Alert.show(dateformat.format(input.value));
}
private function showTime():void{
Alert.show(dateformat.format(df.selectedDate.toDateString())+" "+format2.format(input.value));
}
]]>
</mx:Script>
</mx:Application>