OK, I've got it working how I wanted. Would love to hear feedback on
my structure as well as whether or not you find this useful.

Usage:

<local:QuickDateFormatter id="qdf" date="{fieldOne.text}"
dateFormat="{fieldTwo.text}" />
<mx:Label text="{qdf.output}"/>

Source class:

package
{
    import mx.formatters.DateFormatter;

    public class QuickDateFormatter extends DateFormatter
    {
        private var _str_dateString:String;
        private var _str_dateFormat:String;
        [Bindable] public var output:String;
        
        public function get date():String
        {
                return _str_dateString;
        }
        
        public function set date(a_str:String):void
        {
                _str_dateString = a_str;
                reformat();
        }
        
        public function get dateFormat():String
        {
                return _str_dateFormat;
        }
        
        public function set dateFormat(a_str:String):void
        {
                _str_dateFormat = a_str;
                reformat();
        }
        
        private function reformat():void
        {
                var f:DateFormatter = new DateFormatter();
            f.formatString = _str_dateFormat;
            output =
f.format(DateFormatter.parseDateString(_str_dateString));
        }
    }
}

Let me know what you think!
Ben
http://www.returnundefined.com/






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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