all I want to do is check to see if a date is selected, trace something; else, trace something else. simple enough right?
assuming my_dc as DateChooser instance name, I use:
this.onEnterFrame = function() {
yesterday = new Date(2009, 0, 22);
my_dc.selectedDate = yesterday;
}
works, no other date can be selected beside the one specified in the “yesterday” variable.
if I put this code in the my_dc dateChooser component:
on(change) {
trace(this.selectedDate);
}
works, output is the date you just clicked.
now, I try to do a conditional statement… anywhere:
this.onEnterFrame = function() {
yesterday = new Date(2009,0,22);
if(my_dc.selectedDate == yesterday) {
trace(“that’s yesterday”);
}else{
trace(“that’s not yesterday”;
}
}
or in the component:
on(change) {
yesterday = new Date(2009,0,22);
if(my_dc.selectedDate == yesterday) {
trace(“that’s yesterday”);
}else{
trace(“that’s not yesterday”;
}
}
neither work!:{
i’ve tried different things in the conditional statement like:
if(my_dc.selectedDate == new Date(2009,0,2))
if(my_dc.selectedDate == 2009,0,2)
if(my_dc.selectedDate == ‘2009,0,2’)
if(my_dc.selectedDate == (2009,0,2))
and a lot of others and I can’t get this working…
I was wondering if someone knew why i can’t use the dateChooser.selectedDate property in a conditional statement, or how I’m doing it wrong.
thanks