Here's an example how to achieve this taken from a current project. First, the 
default formats are setup by using the mx.formatters.DateBase class. Then, they 
are applied to the DateChooser class (so it works with the DateChooser and the 
DateField class)

Beware, this technique uses the prototype property (AS 1.0 oop-style) of the 
DateChooser class which may not work in future versions of Flex.

You could also assign a default date formatting function by setting 
DateChooser.prototype.dateFormatter to a function that returns a formatted 
Srting.

  import mx.formatters.DateBase;
  import mx.controls.DateChooser;

  DateBase.defaultDayNamesLong = ["Sonntag", "Montag", "Dienstag", "Mittwoch", 
"Donnerstag", "Freitag", "Sonnabend"];
  DateBase.defaultDayNamesShort = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
  DateBase.defaultMonthNamesLong = ["Januar", "Februar", "M�rz", "April", 
"Mai", "Juni", "Juli", "August", "September", "Oktober", "November", 
"Dezember"];
  DateBase.defaultMonthNamesShort = ["Jan", "Feb", "M�r", "Apr", "Mai", "Jun", 
"Jul", "Aug", "Sep", "Okt", "Nov", "Dez"];

  // assign the above to the DateChooser prototype
  DateChooser.prototype.monthNames = DateBase.defaultMonthNamesLong;
  DateChooser.prototype.dayNames = DateBase.defaultDayNamesShort;
  DateChooser.prototype.firstDayOfWeek = 1;

Dirk.


> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
> Behalf Of joao_m_fernandes
> Sent: Friday, May 13, 2005 1:54 PM
> To: [email protected]
> Subject: [flexcoders] Date formating application wide
> 
> 
> Hi there,
> 
> Is there a way to set default values other than English formating so
> each component uses it instead of setting formatters everywhere.
> 
> Example, If I have several DateFields and DateChoosers I want to be
> able just to set in the main Application weekday names (or month
> names) and those components use it as default.
> 
> If I set <mx:DateField> automaticly it should use my definitions of
> dayNames and monthNames without setting it directly in the component.
> 
> Any Idea how I can achieve this?
> 
> Thanks,
> 
> Jo�o Fernandes
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to