just to share,  here is what I came up with called from the change event:  I am 
also 
restricting the input to numbers, :, AM, PM



                private function processTime( event : Event ) : void {


                        var cbtLength : int = this.text.length;
                        // IF FIRST DIGIT IS > 1 ASSUME THEY FORGOT THE LEADING 
ZERO
                        if (cbtLength == 1 && this.text.charAt(0) > '1')
                                { 
                                this.text = "0" + this.text + ':';
                                this.setSelection(4,4) ;
                                }
                                
                        if (cbtLength == 2) {   // 2 CHARACTERS ENTERED, IF 
LAST ONE IS : ADD 
LEADING ZERO
                                if (this.text.charAt(1) == ":") {
                                        this.text = "0" + this.text ;
                                        this.setSelection(4,4) ;
                        } else {
                                        this.text  +=  ":" ;  // ELSE ADD COLON 
TO END
                                        this.setSelection(4,4) ;
                                        }
                        }

                        if (cbtLength == 5) {   // AFTER 5 CHARACTERS ENTERED 
ADD THE AM 
OR PM
                                if (this.text.substr(0,2) > "06" && 
this.text.substr(0,2) < "12") 
this.text += ' AM'  else  this.text += ' PM' ;
                                }
                }








--
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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> 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