Mega Code Archive

 
Categories / Flex / Data Model
 

Using the PhoneFormatter class

<?xml version="1.0"?> <!-- formatString value        Input         Output ###-####                  1234567       456-7890 (###) ### ####            1234567890    (123) 456-7890 ###-###-####              11234567890   123-456-7890 #(###) ### ####           11234567890   1(123) 456 7890 #-###-###-####            11234567890   1-123-456-7890 +###-###-###-####         1231234567890 +123-123-456-7890 --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">   <mx:Script>          [Bindable]     private var newNumber:Number = 1234567;        </mx:Script>   <mx:PhoneFormatter id="PhoneDisplay" areaCode="415"     formatString="###-####" />   <mx:TextInput id="myTI"     initialize="myTI.text=PhoneDisplay.format(newNumber);" /> </mx:Application>