0

I am trying to customize a date picker to be used in an application, that based on what type of person they are they are limited to a specific date range in the calendar. for example if they were type1 they would be able to select 30 days from the current date and all days before that would be grayed out and all days past the 30 would be grayed out as well. I have searched Google and not come up with anything so any help would be so appreciated.

Thanks

1 Answers1

0

I'm going to assume you're using a mx DateChooser component, I'm not familiar with the calendar component in Flash CS6. Either way I'm sure the code is quite similar.

You can supply a disable date range to the DateChooser component

<mx:DateChooser id="myDate" />

All you need to do is get the current date, subtract 30 days and set that as the range end.

var d:Date = new Date(); //current date
d.date -= 30; //-30 days, yup- its that easy
myDate.disabledRanges = [ {rangeEnd:d} ] //disabledRanges takes an array of objects 
                                         //with rangeStart and rangeEnd
                                         //you don't need a start date since you want to disable all dates before 30 days ago.

Hope this helps

francis
  • 5,889
  • 3
  • 27
  • 51