国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > WEB開發 > 正文

2.11.使用Calendar控件

2024-04-27 13:51:46
字體:
來源:轉載
供稿:網友
2.11.1. 問題
你想要允許用戶在一個日歷樣式的控件中選擇日期。
2.11.2. 解決辦法
使用DateField 控件或DataChooser 控件讓用戶選擇日期。
2.11.3. 討論
Flex 框架提供了兩個控件用來實現日歷樣式的功能:DateField 和DateChooser 控件。DateField控件提供了一個TextInput 控件和一個點擊可以打開日歷的日歷圖標。DateChooser,則不同,它提供了一個可視的日歷給用戶操作。下列范例是一個簡單的旅程計算器用來展示兩種類型的控件。用戶使用DateField 選擇開始日期,使用DateChooser 選擇結束日期。程序會在控件的change 事件觸發update 事件處理函數中計算旅途持續時間。兩個控件的selectedDate屬性會返回用戶選擇的Date 對象。
+展開
-XML
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical">

<mx:Form>
<mx:FormHeading label="Trip Calculator"/>
<mx:FormItem label="Start Date">
<mx:DateField id="startDatechange="update(event)"/>
</mx:FormItem>
<mx:FormItem label="End Date">
<mx:DateChooser id="endDatechange="update(event)"/>
</mx:FormItem>
<mx:FormItem label="Trip Duration (days)">
<mx:Label id="display"/>
</mx:FormItem>
</mx:Form>
<mx:Script>
<![CDATA[
import mx.events.CalendarLayoutChangeEvent;
private static const MILLISECONDS:int = 1000;
private static const SECONDS:int = 60;
private static const MINUTES:int = 60;
private static const HOURS:int = 24;
private function
update(evt:CalendarLayoutChangeEvent):void {
try {
var diff:Number = endDate.selectedDate.getTime()
-startDate.selectedDate.getTime();
// convert the millisecond into days
var days:int =
int(diff/(MILLISECONDS*SECONDS*MINUTES*HOURS));
display.text = days.toString();
}c
catch(ex:Error) {
}
}

]]>
</mx:Script>
</mx:Application>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 嘉黎县| 商洛市| 浦城县| 永安市| 彭州市| 吉水县| 郎溪县| 青龙| 米林县| 林州市| 金阳县| 周至县| 拉萨市| 铜梁县| 建水县| 靖州| 永德县| 莒南县| 英吉沙县| 温宿县| 山阳县| 磐安县| 丽江市| 南皮县| 仙桃市| 拜城县| 南岸区| 中宁县| 辽源市| 卢湾区| 陈巴尔虎旗| 苏州市| 灵石县| 株洲县| 石河子市| 旺苍县| 台北市| 龙州县| 荥经县| 德江县| 中山市|