Hey Tom,
Does this help? Just a simple example grabbing the date and setting it when the app initializes.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="displayDate();">
<mx:Script>
function displayDate(date) {
var today_date:Date = new Date();
var date_str:String = (today_date.getDate()+"/"+(today_date.getMonth()+1)+"/"+today_date.getFullYear());
mx.controls.Alert.show(date_str,"Message"); // displays current date in United States date format
selectedDate.text = date_str;
}
</mx:Script>
<mx:DateChooser id="date1" change="displayDate(event.target.selectedDate)"/>
<mx:TextInput id="selectedDate"/>
</mx:Application>
Hi Mike -
Thanks for the suggestion.
I ended up doing something similar, but using the initialize property of the DateField rather than the app as a whole. I also had to keep using the selectedDate property to set the same date in the calendar chooser.
I had been looking for a somewhat tidier solution (where the default date only has to be set in one place), but this does work.
- Tom

