欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Flex DateField 日期范围

程序员文章站 2022-07-12 15:36:53
...

    开始日期 与 结束日期的范围选择
    两者都不能大于今天,开始日期不能大于结束日期

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" backgroundGradientColors="[#ffffff, #ffffff]">
        <mx:Script>
                <![CDATA[
                        import mx.controls.DateField;
                        
                        [Bindable]
                        private var today:Date = new Date(new Date().setHours(0,0,0,0));
                        [Bindable]
                        private var start:Date = today;
                        [Bindable]
                        private var end:Date = start;
                        
                        //=======================================
                        //Event Handler
                        //=======================================
                        
                        /*DateChange*/
                        private function onDateChangeHandler(event:Event):void
                        {
                                //var currentDF:DateField = DateField(event.currentTarget);
                                
                                
                                if(startDF.text == "")
                                {
                                        startDF.selectedDate = start;
                                }
                                else
                                {
                                        start = startDF.selectedDate;        
                                }
                                
                                if(endDF.text == "")
                                {
                                        endDF.selectedDate = this.end;
                                }
                                else
                                {
                                        this.end = endDF.selectedDate;
                                }
                                
                        }                        
                        
                ]]>
        </mx:Script>
        <mx:ApplicationControlBar width="446" dock="true">
                <mx:Label text="开始日期:" />
                <mx:DateField id="startDF"  showToday="true"  selectedDate="{start}" formatString="YYYY年MM月DD日"
                        selectableRange="{{rangeEnd:end}}" change="onDateChangeHandler(event)"/>
                        
                <mx:Label text="结束日期:"/>
                <mx:DateField id="endDF" showToday="true" selectedDate="{end}" formatString="YYYY年MM月DD日"
                        selectableRange="{{rangeStart:start,rangeEnd:today}}" change="onDateChangeHandler(event)"/>
        </mx:ApplicationControlBar>
        
</mx:Application>

 

相关标签: Flex Adobe XML

上一篇: to_char 函数

下一篇: to_char 函数