PhoneFormatter and formatting parameters : PhoneFormatter « Data Model « Flex






PhoneFormatter and formatting parameters

PhoneFormatter and formatting parameters
     


<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->



<!-- formatters\MainPhoneFormatter.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <fx:Script> 
         
        // Define variable to hold the phone number. 
        [Bindable] 
        private var newNumber:Number = 1234567; 
      
    </fx:Script>
    <fx:Declarations>
        <!-- Declare a PhoneFormatter and define formatting parameters.-->
        <mx:PhoneFormatter id="PhoneDisplay" areaCode="415"
            formatString="###-####" />
    </fx:Declarations>
    <!-- Trigger the formatter while populating a string with data-->
    <s:TextInput id="myTI" initialize="myTI.text=PhoneDisplay.format(newNumber);" />
</s: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.Using the PhoneFormatter classUsing the PhoneFormatter class
10.Use error property to check if a problem occurred during formattingUse error property to check if a problem occurred during formatting