<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" minWidth="955" minHeight="600"> <mx:Script> <!--[CDATA[ import mx.events.CalendarLayoutChangeEvent; private function update(event:CalendarLayoutChangeEvent):void{ try{ var diff:Number = endDate.selectedDate.getTime() -startDate.selectedDate.getTime(); //convert the millisecond into days var days:int = int(diff/(1000*60*60*24)); disp.text = days.toString(); }catch(ex:Error){ } } ]]--> </mx:Script> <mx:Form> <mx:FormHeading label="Trip Calculator"/> <mx:FormItem label="Start Date"> <mx:DateField id="startDate" change="update(event)"/> </mx:FormItem> <mx:FormItem label="End Date"> <mx:DateChooser id="endDate" change="update(event)"/> </mx:FormItem> <mx:FormItem label="Trip Duration(days)"> <mx:Label id="disp"/> </mx:FormItem> </mx:Form> </mx:Application>
dateField dateChoose 用法
最新推荐文章于 2021-03-19 14:36:17 发布