Using the PhoneFormatter class : PhoneFormatter « Data Model « Flex






Using the PhoneFormatter class

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>

   
    
    
    
    
  








Related examples in the same category

1.Using declared PhoneFormatter defined in mxmlUsing declared PhoneFormatter defined in mxml
2.PhoneFormatter for formatting unformatted phone digitsPhoneFormatter for formatting unformatted phone digits
3.Using ActionScript to format based on data lengthUsing ActionScript to format based on data length
4.Create an instance of a PhoneFormatter using ActionScriptCreate an instance of a PhoneFormatter using ActionScript
5.Set format string for PhoneFormatterSet format string for PhoneFormatter
6.Set validPatternChars for PhoneFormatterSet validPatternChars for PhoneFormatter
7.Add area code for PhoneFormatterAdd area code for PhoneFormatter
8.Set area code format for PhoneFormatterSet area code format for PhoneFormatter
9.PhoneFormatter and formatting parametersPhoneFormatter and formatting parameters
10.Use error property to check if a problem occurred during formattingUse error property to check if a problem occurred during formatting