2 Replies Latest reply on May 20, 2010 6:35 PM by UbuntuPenguin

    Common Formatter in Actionscript - used in MXML giving a warning?


      I have a custom DateFormatter.  It is defined in an ActionScript class, and it is a singleton.  I want to re-use it for all of my grids that have a date/time column.


      So, in the MXML where i have these grids, i have set the AdvancedDataGridColumn's formatter to point to my singleton instance.


      The formatting works fine.  Comes out exactly as i want it.  The problem is, I am seeing the following warning:

      warning: unable to bind to property 'shortDateFormatter' on class 'project.util::MainFormatters' (class is not an IEventDispatcher)


      The MXML looks like this:

      <mx:AdvancedDataGridColumn dataField="EntryDate" headerText="Date" formatter="{MainFormatters.Singleton.shortDateFormatter}" textAlign="left" />


      The ActionScript looks like this:

      private var _ShortDateFormatter:DateFormatter = null;



      * Getter for the shortDateFormatter.  If it is null, create our default.


      public function get shortDateFormatter():Formatter


           if(_ShortDateFormatter == null)


                _ShortDateFormatter = new DateFormatter();


                // TODO: this should be sensitive to locale...

                _ShortDateFormatter.formatString = "MM/DD/YYYY";



           return _ShortDateFormatter;



      Any help you can provide in getting rid of this warning would be greatly appreciated.  I must admit, I'm more of a C# guy and somewhat new to the Flex landscape. 


      Thanks in advance.