| Package | mx.formatters |
| Class | public class CurrencyFormatter |
| Inheritance | CurrencyFormatter Formatter Object |
alignSymbol property를 사용해, 통화 기호를 수치의 좌우 어느 쪽으로 두는지를 지정합니다. 통화 기호에는, 스페이스도 포함해 복수의 캐릭터를 사용할 수 있습니다.
에러가 발생하면, empty의 string가 돌려주어져 에러를 설명하는 string가 error property에 보존됩니다. 이 error property로 지정할 수 있는 값은, 다음 가운데 머지않아인가입니다.
"Invalid value" 는, 무효인 수치가 format() Methods에게 건네진 것을 나타냅니다. 값은, Number 형 또는 String 형의 유효한 수치일 필요가 있습니다. "Invalid format" 는, 몇개의 Parameters에, 사용할 수 없는 설정이 포함되어 있는 것을 나타냅니다.
MXML 문장구조법의 비표시
<mx:CurrencyFormatter> 태그는, Super 클래스의 모든 태그 속성을 Inheritance해, 다음의 태그 속성을 추가합니다.
<mx:CurrencyFormatter alignSymbol="left|right" currencySymbol="$" decimalSeparatorFrom=". " decimalSeparatorTo=". " precision="-1" rounding="none|up|down|nearest" thousandsSeparatorFrom="," thousandsSeparatorTo="," useNegativeSign="true|false" useThousandsSeparator="true|false" />
See also
| property | 정의 | ||
|---|---|---|---|
| alignSymbol : String
통화 기호의 위치를, 포맷이 끝난 수치의 좌측 또는 우측으로 설정합니다.
| CurrencyFormatter | ||
![]() | constructor : Object
특정의 object 인스턴스의 클래스 object 또는 constructor 함수에의 참조입니다.
| Object | |
| currencySymbol : String
포맷의 대상이 되는 수치의 통화 기호로서 사용되는 캐릭터를 나타냅니다.
| CurrencyFormatter | ||
| decimalSeparatorFrom : String
입력 string를 해석할 때에 사용하는 소수점의 단락 기호 캐릭터입니다.
| CurrencyFormatter | ||
| decimalSeparatorTo : String
포맷 한 소수의 값을 출력할 경우에 사용하는 소수점의 단락 캐릭터를 나타냅니다.
| CurrencyFormatter | ||
![]() | error : String
에러가 발생했을 때에 Formatter에 의해 보존되는 설명을 나타냅니다.
| Formatter | |
| precision : int
출력 string에 포함하는 소수의 자리수를 나타냅니다.
| CurrencyFormatter | ||
![]() | prototype : Object
[static]
클래스 또는 함수 object의 prototype object에의 참조입니다.
| Object | |
| rounding : String
수치를 사사오입 하는 방법을 나타냅니다.
| CurrencyFormatter | ||
| thousandsSeparatorFrom : String
입력 string로 자리수 단락 기호로서 사용하는 캐릭터를 나타냅니다.
| CurrencyFormatter | ||
| thousandsSeparatorTo : String
출력 string로 자리수 단락 기호로서 사용하는 캐릭터를 나타냅니다.
| CurrencyFormatter | ||
useNegativeSign : Boolean
true 의 경우, 음수의 전에 마이너스 ("-") 기호를 붙여 포맷 합니다. | CurrencyFormatter | ||
useThousandsSeparator : Boolean
true 의 경우, 수치는 3 자리수 마다 단락지어 캐릭터로 단락지어집니다. | CurrencyFormatter | ||
| Methods | 정의 | ||
|---|---|---|---|
| CurrencyFormatter ()
constructor .
| CurrencyFormatter | ||
format (value:Object ):String
value 를 통화로 해서 포맷 합니다. | CurrencyFormatter | ||
![]() | 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 | |
| alignSymbol | property |
public var alignSymbol:String
통화 기호의 위치를, 포맷이 끝난 수치의 좌측 또는 우측으로 설정합니다. 지정할 수 있는 값은,"left" 및 "right" 입니다.
디폴트치"left".
| currencySymbol | property |
public var currencySymbol:String 포맷의 대상이 되는 수치의 통화 기호로서 사용되는 캐릭터를 나타냅니다. "$" (이)나 "YEN" 등, 통화 기호를 나타내는 캐릭터를 사용할 수 있습니다. 게다가 통화 기호와 포맷 대상 수치의 사이에 스페이스를 사이에 둘 수도 있습니다. 수치가 부의 값의 경우, 통화 기호는 수치와 마이너스 기호 또는 괄호와의 사이에 표시됩니다.
디폴트치"$".
| decimalSeparatorFrom | property |
| decimalSeparatorTo | property |
| precision | property |
public var precision:int
출력 string에 포함하는 소수의 자리수를 나타냅니다. precision 를 -1 로 설정하면 precision 를 무효로 할 수 있습니다. 값이 -1 의 경우, 자리수를 변경하지 않습니다. 예를 들어, 입력치가 1.453 으로 rounding 가 NumberBaseRoundType.NONE 로 설정되어 있는 경우, 1.453 을 돌려줍니다. precision 가 -1 로, 어떠한 사사오입의 형식을 설정해 있는 경우, 그 사사오입 타입에 근거한 값을 돌려줍니다.
디폴트치-1.
| rounding | property |
public var rounding:String
수치를 사사오입 하는 방법을 나타냅니다. ActionScript 에서는, 값은 NumberBaseRoundType.NONE,NumberBaseRoundType.UP,NumberBaseRoundType.DOWN, 또는 NumberBaseRoundType.NEAREST 가 됩니다. MXML 에서는, 값은 "none","up","down", 또는 "nearest" 가 됩니다.
디폴트치NumberBaseRoundType.NONE.
See also
| thousandsSeparatorFrom | property |
| thousandsSeparatorTo | property |
| useNegativeSign | property |
public var useNegativeSign:Boolean
true 의 경우, 음수의 전에 마이너스 ("-") 기호를 붙여 포맷 합니다. false 의 경우, 수치는, (400)와 같이 괄호로 둘러싸여 포맷 됩니다.
디폴트치true.
| useThousandsSeparator | property |
| CurrencyFormatter | () | constructor |
public 함수 CurrencyFormatter()constructor .
| format | () | Methods |
public override function format(value:Object ):String
value 를 통화로 해서 포맷 합니다. value 를 포맷 할 수 없는 경우, empty의 string가 돌려주어져error property에 에러의 설명이 기입해집니다.
value:Object — 포맷 하는 값을 나타냅니다.
|
String —
포맷 한 string. 에러가 발생했을 경우는 empty입니다.
|
<? xml version="1.0" encoding="utf-8"? >
<! -- Simple example to demonstrate the CurrencyFormatter. -->
<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 = numVal.validate();
if (vResult.type==ValidationResultEvent.VALID) {
var temp:Number=Number(priceUS.text);
formattedUSPrice.text= usdFormatter.format(temp);
}
else {
formattedUSPrice.text="";
}
}
]]>
</mx:Script>
<mx:CurrencyFormatter id="usdFormatter" precision="2"
currencySymbol="$" decimalSeparatorFrom=". "
decimalSeparatorTo=". " useNegativeSign="true"
useThousandsSeparator="true" alignSymbol="left"/>
<mx:NumberValidator id="numVal" source="{priceUS}" property="text"
allowNegative="true" domain="real"/>
<mx:Panel title="CurrencyFormatter Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Form>
<mx:FormItem label="Enter U.S. dollar amount:">
<mx:TextInput id="priceUS" text="" width="50%"/>
</mx:FormItem>
<mx:FormItem label="Formatted amount: ">
<mx:TextInput id="formattedUSPrice" text="" width="50%" 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/CurrencyFormatter.html