View Full Version : using formatter in component binding

03-09-2004, 05:47 PM

I am working on a small application that uses a field from a mysql table where the field type is date.

I would like to use the datefield compontent to change the field in my table, however the format of the datefield component is not the same as required by mysql.

if I use the following actionscript, I can change the format of the datefield component, but this is only for the text output. I would like to take advantage of the formatter option within the bindings tab.

my_datefield.dateFormatter = function(d: Date) {
return d.getFullYear()+"/ "+(d.getMonth()+1)+"/ "+d.getDate();

By using the formatter option, I can bind the datefield to my dataset and not have to worry about writing all sorts of functions to do it manually.

Any ideas how to write my AS from above into a little formatter for my datafield?