Create an instance of a PhoneFormatter using ActionScript : PhoneFormatter « Data Model « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Data Model » PhoneFormatterScreenshots 
Create an instance of a PhoneFormatter using ActionScript
Create an instance of a PhoneFormatter using ActionScript
   

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.formatters.*;
        [Bindable]
        public var rawPhone:String = "2223333";
        public function formatThis(plainText:String):String
        {
            var fmtPhone:PhoneFormatter = new PhoneFormatter();
            
            if(plainText.length == 7)
                fmtPhone.formatString = "###-####";
            else
                fmtPhone.formatString = "###-###-####";
            return(fmtPhone.format(plainText));
        }
      
    </mx:Script>
    <mx:Label text="{formatThis(rawPhone)}" />
</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.Set format string for PhoneFormatterSet format string for PhoneFormatter
5.Set validPatternChars for PhoneFormatterSet validPatternChars for PhoneFormatter
6.Add area code for PhoneFormatterAdd area code for PhoneFormatter
7.Set area code format for PhoneFormatterSet area code format for PhoneFormatter
8.Using the PhoneFormatter classUsing the PhoneFormatter class
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
w___ww___.j__a__va2_s___.c__om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.