| Package | mx.formatters |
| Class | public class SwitchSymbolFormatter |
| Inheritance | SwitchSymbolFormatter Object |
예를 들어, SwitchSymbolFormatter 클래스에 다음의 정보를 지정합니다.
포맷 string :"The SocialSecurity number is: ###-##-####"
입력 string : "123456789"
SwitchSymbolFormatter 클래스는, 포맷 string를 해석해, 각 플레이스홀더-캐릭터 (디폴트 "#")를 입력 string의 숫자에 값환합니다. 덧붙여 입력 string의 숫자는, 입력 string로 지정되고 있는 차례로 삽입됩니다. 다른 플레이스홀더-기호를 정의하려면 , SwitchSymbolFormatter object를 인스턴스화할 때에, constructor 에 그 기호를 건네줍니다.
SwitchSymbolFormatter 클래스에서 이러한 2 개의 string로부터 작성되는 출력 string는, 다음과 같이 됩니다.
"The SocialSecurity number is: 123-45-6789"
패턴으로 사용하는 캐릭터에는, string의 수치의 부분의 값의 정수가 되는, 임의의 캐릭터를 지정할 수 있습니다. 다만, 포맷 하는 값은 수치일 필요가 있습니다.
소스치로 지정하는 자리수는, 패턴 string로 정의되고 있는 자리수로 일치할 필요가 있습니다. SwitchSymbolFormatter object를 호출하는 스크립트에서는, 이것에 주의해 주세요.
See also
| Methods | 정의 | ||
|---|---|---|---|
| SwitchSymbolFormatter (numberSymbol:String = "#")
constructor .
| SwitchSymbolFormatter | ||
| formatValue (format:String , source:Object ):String
포맷 패턴을 사용해 소스 string를 포맷 하는 것에 의해, 새로운 string를 작성합니다.
| SwitchSymbolFormatter | ||
![]() | hasOwnProperty (name:String ):Boolean
object로 지정된 property가 정의되고 있는지 어떤지를 나타냅니다.
| Object | |
![]() | isPrototypeOf (theClass:Object ):Boolean
Object 클래스의 인스턴스가, Parameters로서 지정된 object의 prototype 체인내에 있을지 어떨지를 나타냅니다.
| Object | |
![]() | propertyIsEnumerable (name:String ):Boolean
지정된 property가 존재해, 열거 가능한가 어떤가를 나타냅니다.
| Object | |
![]() | setPropertyIsEnumerable (name:String , isEnum:Boolean = true):void
루프 처리에 대한 다이나믹 property의 가용성을 설정합니다.
| Object | |
![]() | toString ():String
지정된 object의 string 표현을 돌려줍니다.
| Object | |
![]() | valueOf ():Object
지정된 object의 원시적치를 돌려줍니다.
| Object | |
| SwitchSymbolFormatter | () | constructor |
public 함수 SwitchSymbolFormatter(numberSymbol:String = "#")constructor .
ParametersnumberSymbol:String (default = "#") — 패턴 캐릭터로서 사용하는 캐릭터를 나타냅니다.
|
| formatValue | () | Methods |
public function formatValue(format:String , source:Object ):String 포맷 패턴을 사용해 소스 string를 포맷 하는 것에 의해, 새로운 string를 작성합니다.
Parametersformat:String — 유저가 요구한 패턴 추가를 정의하는 string를 나타냅니다.
|
|
source:Object — 유효한 수치 줄을 나타냅니다. 필요에 따라서 알파 캐릭터를 사용할 수 있습니다.
|
String |
<? xml version="1.0" encoding="utf-8"? >
<! -- Simple example to demonstrate SwitchSymbolFormatter. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<! [CDATA[
import mx.formatters.SwitchSymbolFormatter;
import mx.events.ValidationResultEvent;
private var vResult:ValidationResultEvent;
// Event handler to validate and format input.
private function Format() :void
{
vResult = scVal.validate();
if (vResult.type==ValidationResultEvent.VALID) {
var switcher:SwitchSymbolFormatter=new SwitchSymbolFormatter('#');
formattedSCNumber.text =
switcher.formatValue("Formatted Social Securty number: ###-##-#### ", scNum.text);
}
else {
formattedSCNumber.text= "";
}
}
]]>
</mx:Script>
<mx:SocialSecurityValidator id="scVal" source="{scNum}" property="text"/>
<mx:Panel title="SwitchSymbolFormatter Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Label text="Enter a 9 digit Social Security number with no separator characters:"/>
<mx:TextInput id="scNum" text="" maxChars="9" width="50%"/>
<mx:Button label="Validate and Format" click="Format();"/>
<mx:TextInput id="formattedSCNumber" editable="false" width="75%"/>
</mx:Panel>
</mx:Application>
코멘트가 추가되었을 경우, 메일로 받기. | 코멘트 리포트
현재의 페이지: http://flexdocs.kr/docs/flex2/langref/mx/formatters/SwitchSymbolFormatter.html