Format input with ZipCodeFormatter : ZipCodeFormatter « Data Model « Flex






Format input with ZipCodeFormatter

Format input with ZipCodeFormatter
  
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.formatters.*;
        
        public var fmtZip:ZipCodeFormatter = new ZipCodeFormatter();

        public function formatThis(plainText:String,formatString:String):String
        {
            fmtZip.formatString = formatString;
            return(fmtZip.format(plainText));
        }
      
    </mx:Script>
    <mx:Label text="Canadian Postal Code: {formatThis('111111','### ###')}" />
</mx:Application>


    
    

   
    
  








Related examples in the same category

1.Using ZipCodeFormatter to format a 5+4 ZIP CodeUsing ZipCodeFormatter to format a 5+4 ZIP Code
2.Custom formatting function accepts a formatting patternCustom formatting function accepts a formatting pattern