ActionScript 2.0 Components Language Reference |
|
|
|
| DateField component > Using the DateField component > Creating an application with the DateField component | |||
The following procedure explains how to add a DateField component to an application while authoring. In this example, the DateField component allows a user to pick a date for an airline reservation system. All dates before today's date must be disabled. Also, a 15-day range in December must be disabled to create a holiday black-out period. Also, some flights are not available on Mondays, so all Mondays must be disabled for those flights.
To create an application with the DateField component:
flightCalendar.selectableRange = {rangeStart:new Date(2001, 9, 1), rangeEnd:new Date(2003, 11, 1)};
This code assigns a value to the selectableRange property in an ActionScript object that contains two Date objects with the variable names rangeStart and rangeEnd. This defines an upper and lower end of a range within which the user can select a date.
flightCalendar.disabledRanges = [{rangeStart: new Date(2003, 11, 15), rangeEnd: new Date(2003, 11, 31)}, {rangeEnd: new Date(2003, 6, 16)}];
flightCalendar.disabledDays=[1];
To create a DateField component instance using ActionScript:This adds the component to the library, but doesn't make it visible in the application.
this.createClassObject(mx.controls.DateField, "my_df", 1);
This script uses the method UIObject.createClassObject() to create the DateField instance.
|
|
|
|