
转载请保持文章完整性!
本文链接地址:http://blog.desizen.com/4lone/285.html
主页:joel's blog
这个例子进行的是UI Controls:Data Entry Controls:DateField
我不知道我这样的翻译是不是正确,不过它的功能就是给出一个文本域,点击后就弹出一个日期选择框可供选择.
以下是它的简介:
The DateField control is a text field that shows the date with a calendar icon on its right side. When the user clicks anywhere inside the bounding box of the control, a DateChooser control pops up and shows the dates in the month of the current date. If no date is selected, the text field is blank and the month of the current date is displayed in the DateChooser control. When the DateChooser control is open, the user can scroll through months and years, and select a date. When a date is selected, the DateChooser control closes, and the text field shows the selected date. The user can also type the date in the text field if the editable property of the DateField control is set to true.
例子:
<?xml version="1.0" encoding="utf-8"?> <!-- Simple example to demonstrate the DateField control. --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" verticalAlign="top" horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" paddingTop="0" paddingBottom="0" viewSourceURL="srcview/index.html"> <!--这个例子与之前所介绍的DateChooser极其的相似,所以就没有加注释了--> <mx:Script> <![CDATA[ // Event handler for the DateField change event. private function dateChanged(date:Date):void { if (date == null) selection.text = "Date selected: "; else selection.text = "Date selected: " + date.getFullYear().toString() + '/' + (date.getMonth()+1).toString() + '/' + date.getDate(); } ]]> </mx:Script> <mx:DateFormatter id="df"/> <mx:Panel title="DateField Control Example" width="600" color="0xffffff" borderAlpha="0.15" height="240" layout="horizontal" horizontalGap="15" paddingLeft="10" paddingTop="10" paddingRight="10" paddingBottom="10" horizontalScrollPolicy="off" verticalScrollPolicy="off"> <mx:VBox width="50%" borderColor="0xDCDCDC" borderStyle="solid" height="100%" paddingLeft="10"> <mx:Label id="selection" color="0x323232" text="Date selected:" /> <mx:DateField id="dateField1" yearNavigationEnabled="true" change="dateChanged(DateField(event.target).selectedDate)" color="0x000000"/> <mx:Label color="0x000000" text="Basic DateField:"/> <mx:Text width="100%" color="0x323232" text="Select a date in the DateField control. Select it again while holding down the Control key to clear it."/> </mx:VBox> <mx:VBox width="50%" borderColor="0xDCDCDC" borderStyle="solid" height="100%" paddingLeft="10"> <mx:Label color="0x323232" text="Date selected: {df.format(dateField2.selectedDate)}"/> <mx:DateField id="dateField2" yearNavigationEnabled="true" disabledRanges="{[ {rangeEnd: new Date(2008, 9, 31)} ]}" color="0x000000"/> <mx:Text color="0x000000" text="Disable dates on or before Oct 31, 2008."/> </mx:VBox> </mx:Panel> </mx:Application>
标签:DateField, FLEX, TourDeFlex, 例子

Hi,
http://www.joelove.cn – da best. Keep it going!
Have a nice day
Tania
thanks!