This page was saved using jaction on 2006-09-04 8:33:56.
Address: http://flexdocs.kr/docs/flex2/langref/mx/formatters/PhoneFormatter.html
Title: mx.formatters.PhoneFormatter (Flex™ 2 레퍼런스 가이드)  •  Size: 32280
Packagemx.formatters
Classpublic class PhoneFormatter
InheritancePhoneFormatter Inheritance Formatter Inheritance Object

PhoneFormatter 클래스는, 유효한 수치를 전화번호 (국제전화 번호를 포함한다)의 형식에 포맷 합니다.

7 자리수의 미국 형식의 전화번호에 대해서는, 쇼트 컷이 준비되어 있습니다. areaCode property에 값이 포함되어 7 자리수의 형식의 string (###-####)를 사용했을 경우, 돌려주어지는 string에 자동적으로 시외 국번이 추가됩니다. 에리어 코드의 디폴트의 형식은, (###)입니다. 이 형식은 areaCodeFormat property를 사용해 변경할 수 있습니다. 에리어 코드는, 3 자리수의 플레이스홀더-를 사용하는 한 임의로 설정할 수 있습니다.

에러가 발생하면, empty의 string가 돌려주어져 에러를 설명하는 string가 error property에 보존됩니다. 이 error property로 지정할 수 있는 값은, 다음 가운데 머지않아인가입니다.

MXML 문장구조법expandedMXML 문장구조법의 비표시

<mx:PhoneFormatter> 태그는, Super 클래스의 모든 태그 속성을 Inheritance해, 다음의 태그 속성을 추가합니다.

 <mx:PhoneFormatter areaCode "-1" areaCodeFormat "(###)" formatString="(###) ###-####" validPatternChars "+()#-. " /> 

View the examples

See also

mx.formatters.SwitchSymbolFormatter


Public property
 property정의
  areaCode : int
10 자리수의 전화번호를 구성하기 위해서 미국 형식의 7 자리수의 전화번호에 추가되는 시외 국번 (에리어 코드)을 나타냅니다.
PhoneFormatter
  areaCodeFormat : String
areacode property가 7 자리수 형식에서 표시되었을 경우에 사용되는, 시외 국번의 디폴트의 형식입니다.
PhoneFormatter
 Inheritedconstructor : Object
특정의 object 인스턴스의 클래스 object 또는 constructor    함수에의 참조입니다.
Object
 Inheritederror : String
에러가 발생했을 때에 Formatter에 의해 보존되는 설명을 나타냅니다.
Formatter
  formatString : String
지정의 전화번호의 포맷을 나타내는 마스크 캐릭터를 포함한 string를 나타냅니다.
PhoneFormatter
 Inheritedprototype : Object
[static] 클래스 또는 함수 object의 prototype object에의 참조입니다.
Object
  validPatternChars : String
formatString property로 사용할 수 있는 유효한 캐릭터의 리스트를 나타냅니다.
PhoneFormatter
Protected property
 property정의
 InheriteddefaultInvalidFormatError : String = "Invalid format"
무효인 포맷 string가 formatter로 지정된 것을 나타내는 에러 메세지입니다.
Formatter
 InheriteddefaultInvalidValueError : String = "Invalid value"
무효인 값이 formatter로 지정된 것을 나타내는 에러 메세지입니다.
Formatter
 InheritedpackageResources : ResourceBundle
[static] formatters.properties 로부터의 모든 심볼을 포함한 ResourceBundle object입니다.
Formatter
Public Methods
 Methods정의
  PhoneFormatter ()
constructor   .
PhoneFormatter
  format (value:Object ):String
string를 전화번호로서 포맷 합니다.
PhoneFormatter
 InheritedhasOwnProperty (name:String ):Boolean
object로 지정된 property가 정의되고 있는지 어떤지를 나타냅니다.
Object
 InheritedisPrototypeOf (theClass:Object ):Boolean
Object 클래스의 인스턴스가, Parameters로서 지정된 object의 prototype 체인내에 있을지 어떨지를 나타냅니다.
Object
 InheritedpropertyIsEnumerable (name:String ):Boolean
지정된 property가 존재해, 열거 가능한가 어떤가를 나타냅니다.
Object
 InheritedsetPropertyIsEnumerable (name:String , isEnum:Boolean = true):void
루프 처리에 대한 다이나믹 property의 가용성을 설정합니다.
Object
 InheritedtoString ():String
지정된 object의 string 표현을 돌려줍니다.
Object
 InheritedvalueOf ():Object
지정된 object의 원시적치를 돌려줍니다.
Object
property의 상세
areaCodeproperty
public var areaCode:int

10 자리수의 전화번호를 구성하기 위해서 미국 형식의 7 자리수의 전화번호에 추가되는 시외 국번 (에리어 코드)을 나타냅니다. 값이 -1 의 경우, 전에 시외 국번을 추가하지 않습니다.

디폴트치-1.

areaCodeFormatproperty 
public var areaCodeFormat:String

areacode property가 7 자리수 형식에서 표시되었을 경우에 사용되는, 시외 국번의 디폴트의 형식입니다.

디폴트치"(###) ".

formatStringproperty 
public var formatString:String

지정의 전화번호의 포맷을 나타내는 마스크 캐릭터를 포함한 string를 나타냅니다.

디폴트치"(###) ###-####".

validPatternCharsproperty 
public var validPatternChars:String

formatString property로 사용할 수 있는 유효한 캐릭터의 리스트를 나타냅니다. 이 property는,formatString property의 검증에 사용됩니다.

디폴트치"+()#- . ".

constructor    의 상세
PhoneFormatter()constructor   
public 함수 PhoneFormatter()

constructor   .

Methods의 상세
format()Methods
public override function format(value:Object ):String

string를 전화번호로서 포맷 합니다. 값을 포맷 할 수 없는 경우, empty의 string가 돌려주어져error property에 에러의 설명이 기입해집니다.

Parameters
value:Object — 포맷 하는 값을 나타냅니다.

반환값
String — 포맷 한 string를 나타냅니다. 에러가 발생했을 경우는 empty입니다. 에러 상태를 나타내는 설명이 error property에 기입해집니다.
Examples
PhoneFormatterExample
<? xml version="1.0" encoding="utf-8"? >
<! -- Simple example to demonstrate PhoneFormatter.  -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <! [CDATA[
                
            import mx.events.ValidationResultEvent;            
            private var vResult:ValidationResultEvent;

            // Event handler to validate and format input.             
            private function Format() :void
            {
                vResult = pnVal.validate();
                if (vResult.type==ValidationResultEvent.VALID) {
                    formattedPhone.text= phoneFormatter.format(phone.text);
                }
              
                else {
                    formattedPhone.text= "";
                }
            }
        ]]>
    </mx:Script>

    <mx:PhoneFormatter id="phoneFormatter" 
        formatString="(###) ###-####" validPatternChars="#-() "/>

    <mx:PhoneNumberValidator id="pnVal" source="{phone}" property="text" 
            allowedFormatChars=""/>

    <mx:Panel title="PhoneFormatter Example" width="75%" height="75%" 
            paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">

        <mx:Form>
            <mx:FormItem label="Enter a 10-digit phone number:">
                <mx:TextInput id="phone" text="" width="75%"/>
            </mx:FormItem>

            <mx:FormItem label="Formatted phone number: ">
                <mx:TextInput id="formattedPhone" text="" width="75%" editable="false"/>
            </mx:FormItem>

            <mx:FormItem>
                <mx:Button label="Validate and Format" click="Format();"/>
            </mx:FormItem>
        </mx:Form>

    </mx:Panel>
</mx:Application>






 

코멘트가 추가되었을 경우, 메일로 받기. | 코멘트 리포트

현재의 페이지: http://flexdocs.kr/docs/flex2/langref/mx/formatters/PhoneFormatter.html