Search Flex Components Free

Custom Search

December 20, 2007

Flex Control DateFormatter Source Code Sample

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" backgroundAlpha="0" >
<mx:Script>
private function displayDate(date : Date) : void { if (date == null) selection.text = ''; else selection.text = date.getFullYear().toString() + '/' + (date.getMonth()+1).toString() + '/' + date.getDate(); }
</mx:Script>
<mx:DateFormatter id="df"/>
<mx:VBox> <mx:Label text="Simple Calendar"/> <mx:DateChooser id="date1" change="displayDate(DateChooser(event.target).selectedDate)" yearNavigationEnabled="true" /> <mx:Label id="selection" text="Date selected: "/> </mx:VBox>
<mx:VBox> <mx:Label text="Calendar with ranges disabled"/> <mx:DateChooser id="date2" disabledRanges="{[ {rangeEnd: new Date()} ]}" yearNavigationEnabled="true"/> <mx:Label text="{df.format(date2.selectedDate)}"/> </mx:VBox>
</mx:Application>

Related Flex Tutorials