flex日期选择器

发布时间:2009-05-29 14:05:00 阅读:1052次

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white" fontSize="14" fontFamily="arial">
        <mx:Script>
         <![CDATA[
          import mx.controls.Alert;
          private function a():void{
           var year:String;
           var month:String;
           var day:String;
            //label1.text=df.format(dateChooser.selectedDate).toString();
            year=dateChooser.selectedDate.getFullYear().toString();
            month=(dateChooser.selectedDate.getMonth()+1).toString();
            day=dateChooser.selectedDate.getDate().toString();
            datetext.text=year+"年"+month+"月"+day+"日";
          }
          private function init():void{
           dateChooser.selectedDate=new Date(2008,7,8);
           var newdate:Date=new Date();
           datetext.text=newdate.getFullYear().toString()+"年"+(newdate.getMonth()+1).toString()+"月"+newdate.getDate().toString()+"日";
          }

         ]]>
        </mx:Script>
        <mx:Panel width="236" height="298" layout="absolute">
                <mx:DateChooser id="dateChooser" yearNavigationEnabled="true"
                        headerColors="{[c1.selectedColor, c2.selectedColor]}" creationComplete="init();"  click="a()" x="10" y="10"/>
                <mx:Label text="当前日期:"  y="230" x="11"/><mx:TextInput x="80" y="226" id="datetext"  width="126"/>
        </mx:Panel>
    <mx:ApplicationControlBar dock="true">
        <mx:Form styleName="plain">
            <mx:FormItem label="headerColors:" direction="horizontal">
                <mx:ColorPicker id="c1" selectedColor="#FF0000" />
                <mx:ColorPicker id="c2" selectedColor="#FFFFFF" />
            </mx:FormItem>
        </mx:Form>
    </mx:ApplicationControlBar>
    <mx:DateFormatter id="df"/>
</mx:Application>

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询
上一篇:flex连接fms
下一篇:flex定时器

转载请注明:flex日期选择器 出自老鄢博客 | 欢迎分享