IT기술/Flex

flex 3 달력 (날짜를 클릭하면 년,월,일 출력)

dobbby 2008. 11. 19. 11:16
반응형
statetest.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   import mx.controls.DateChooser;
   function changed(event:Event):void{
    var date:DateChooser = DateChooser(event.currentTarget);
    
    var timeString:String = String(date.selectedDate.getFullYear())+"년";
    timeString += " "+String(date.selectedDate.getMonth()+1)+"월";
    timeString += " "+String(date.selectedDate.getDate())+"일";
    
    mx.controls.Alert.show(timeString);
   }
  ]]>
 </mx:Script>
 <mx:Panel width="250" height="256" layout="absolute" horizontalCenter="0" verticalCenter="0" title="state test">
  <mx:DateChooser horizontalCenter="0" verticalCenter="0" change="changed(event)"/>
 </mx:Panel>
</mx:Application>
반응형