Hi Tracy,
Works great! Here is the code for whoever needs it ;)
my AS: getCurrentDate(commDate);
My Function:
function getCurrentDate(dateField:mx.controls.DateField)
{
dateField.selectedDate = new Date();
}my MXML: <mx:DateField id="commDate"/>
Quoting Tracy Spratt <[EMAIL PROTECTED]>:
=====================================================================
Take out the re-declaration of var myArg, make sure you pass in a reference not a string and that should work fine.
If you will always be passing in a date field, type the argument: public function setCurrentDate(dateField:mx.controls.DateField):Void
Tracy
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 23, 2005 4:01 PM To: [email protected] Subject: Re: [flexcoders] dateField questions?
Hi ibibas,
How would I set up a function to accept an argument like this:
getCurrentDate(myDateFieldNameHere);
I know this isn't correct: function getCurrentDate(myArg) { var myArg; myArg.selectedDate = new Date(); }
I would like to make the function generic so I could reuse it on other screens
using the same external AS file.
thanks, -Art
Quoting [EMAIL PROTECTED]:
Once created the datefield, use this code in a ActionScript function:
inputDate.selectedDate = new Date();
where inputDate:
<mx:DateField id="inputDate" dateFormatter="formatDate" />
You can format it using this function:
function formatDate(item) { var df:DateFormatter = new DateFormatter();
df.formatString = "DD/MM/YYYY"; // this the mask
return df.format(item); }
Hope it helps...;-)
Isaac Bib�s Forado
Yahoo! Groups Links
Yahoo! Groups Links
Yahoo! Groups Links

