Mega Code Archive

 
Categories / Flex / Data Model
 

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>