Set date range for DateChooser
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
public function displayDates():void {
var dateRanges:Array = [];
for (var i:int=0; i<shows.show.length(); i++) {
var cDate:Date = new Date(shows.show[i].showDate.toString());
var cDateObject:Object = {rangeStart:cDate, rangeEnd:cDate};
dateRanges.push(cDateObject);
}
dc1.selectedRanges = dateRanges;
}
</mx:Script>
<mx:XML id="shows" format="e4x">
<data>
<show>
<showID>1</showID>
<showDate>02/12/2010</showDate>
<showTime>10:45am/11:15am</showTime>
</show>
<show>
<showID>2</showID>
<showDate>02/23/2010</showDate>
<showTime>7:00pm</showTime>
</show>
</data>
</mx:XML>
<mx:DateChooser id="dc1" showToday="false" creationComplete="displayDates()" />
</mx:Application>
Related examples in the same category