You have to check that selectedDate is not null. From the do at
http://livedocs.macromedia.com/flex/201/langref/mx/controls/DateChooser.
html#selectedDate
 
Selecting the currently selected date in the control deselects it, sets
the selectedDate property to null, and then dispatches the change event.
 
There is an example at the bottom of the page showing this.
 
Stephen

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of jmfillman
Sent: Monday, February 05, 2007 1:00 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] datechooser bug?



Try the code below. If you click on a date, then click on the same 
date, this throws an error. Am I doing something wrong or is this a 
bug?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " 
layout="absolute">
<mx:DateChooser x="10" y="10" id="schCalendar" change="setDate
()"/> 
<mx:Script>
<![CDATA[
public function setDate():void {
if (schCalendar.selectedDate.day == 0) {
day.text="Sunday";
}
if (schCalendar.selectedDate.day == 1) {
day.text="Monday";
} 
if (schCalendar.selectedDate.day == 2) {
day.text="Tuesday";
}
if (schCalendar.selectedDate.day == 3) {
day.text="Wednesday";
} 

if (schCalendar.selectedDate.day == 4) {
day.text="Thursday";
}
if (schCalendar.selectedDate.day == 5) {
day.text="Friday";
}
if (schCalendar.selectedDate.day == 6) {
day.text="Saturday";
}
} 

]]>
</mx:Script>
<mx:Text x="192" y="51" id="day" width="101" height="20"/>
</mx:Application>



 

Reply via email to