1 Reply Latest reply on May 10, 2010 9:07 AM by Sree_D

    format textinput


      im trying to format a text input to accept timecode i.e. 00:01:23 - i want the textinput to format the data on change but having no luck getting it to work - just wondering if anyone could shed some light on custom formatting .





        • 1. Re: format textinput
          Sree_D Level 2

          Try having an onchange event and access the textinput value as this.text and pass it to the formatter which is defined like below





          var timeFormatter:TimeFormatter = TimeFormatter();

              this.text= timeFormatter.format(this.text);





          Define the TimeFormatter like below








          package com.custom.components



          import mx.formatters.StringFormatter;



          public class TimeFormatter extends StringFormatter



          public function TimeFormatter () {






          public override function format ( value:Object ) : String {


          seperate the input to hrs min sec etc and return the formatted string

          super.format( value );



          return hrs+":"+min+":" sec;