| Package | mx.formatters |
| Class | public class Formatter |
| Inheritance | Formatter Object |
| Subclasses | CurrencyFormatter , DateFormatter , NumberFormatter , PhoneFormatter , ZipCodeFormatter |
format() Methods를 재정의(override) 할 필요가 있습니다.
MXML 문장구조법
MXML 문장구조법의 비표시
다음의 태그 속성이 Formatter 클래스에서 정의되어 이 클래스의 모든 서브 클래스에 Inheritance됩니다.
<mx:tagname Properties error="" />
See also
| property | 정의 | ||
|---|---|---|---|
![]() | constructor : Object
특정의 object 인스턴스의 클래스 object 또는 constructor 함수에의 참조입니다.
| Object | |
| error : String
에러가 발생했을 때에 Formatter에 의해 보존되는 설명을 나타냅니다.
| Formatter | ||
![]() | prototype : Object
[static]
클래스 또는 함수 object의 prototype object에의 참조입니다.
| Object | |
| property | 정의 | ||
|---|---|---|---|
| defaultInvalidFormatError : String = "Invalid format"
무효인 포맷 string가 formatter로 지정된 것을 나타내는 에러 메세지입니다.
| Formatter | ||
| defaultInvalidValueError : String = "Invalid value"
무효인 값이 formatter로 지정된 것을 나타내는 에러 메세지입니다.
| Formatter | ||
| packageResources : ResourceBundle
[static]
formatters.properties 로부터의 모든 심볼을 포함한 ResourceBundle object입니다. | Formatter | ||
| Methods | 정의 | ||
|---|---|---|---|
| Formatter ()
constructor .
| Formatter | ||
| format (value:Object ):String
값을 포맷 해, 새롭고 포맷 된 값을 포함한 string를 돌려줍니다.
| Formatter | ||
![]() | 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 | |
| defaultInvalidFormatError | property |
protected var defaultInvalidFormatError:String = "Invalid format"무효인 포맷 string가 formatter로 지정된 것을 나타내는 에러 메세지입니다.
디폴트치"Invalid format".
| defaultInvalidValueError | property |
protected var defaultInvalidValueError:String = "Invalid value"무효인 값이 formatter로 지정된 것을 나타내는 에러 메세지입니다.
디폴트치"Invalid value".
| error | property |
public var error:String 에러가 발생했을 때에 Formatter에 의해 보존되는 설명을 나타냅니다. 이 property로 사용 가능한 값에 대해서는, 각 Formatter의 설명을 참조해 주세요.
서브 클래스에서는 format() Methods 중(안)에서 이 값을 설정할 필요가 있습니다.
| packageResources | property |
protected static var packageResources:ResourceBundle
formatters.properties 로부터의 모든 심볼을 포함한 ResourceBundle object입니다.
| Formatter | () | constructor |
public 함수 Formatter()constructor .
| format | () | Methods |
public function format(value:Object ):String 값을 포맷 해, 새롭고 포맷 된 값을 포함한 string를 돌려줍니다. 모든 서브 클래스에서 이 Methods를 재정의(override) 해, Formatter를 Implements할 필요가 있습니다.
Parametersvalue:Object — 포맷 하는 값을 나타냅니다.
|
String —
포맷 한 string를 나타냅니다.
|
<? xml version="1.0"? >
<! -- Simple example to demonstrate the Formatter class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<! [CDATA[
// Event handler to format the input.
private function Format() :void
{
// The format() method returns the formatted String,
// or an empty String if there is an error.
var formattedVal:String = numberFormatter.format(inputVal.text);
if (formattedVal.length==0) {
// If there is an error, the Format.error property
// contains the reason.
formattedNumber.text=numberFormatter.error;
}
else {
formattedNumber.text=formattedVal;
}
}
]]>
</mx:Script>
<mx:NumberFormatter id="numberFormatter"/>
<mx:Panel title="NumberFormatter Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Form>
<mx:FormItem label="Enter number - a letter is invalid:">
<mx:TextInput id="inputVal" text="" width="75%"/>
</mx:FormItem>
<mx:FormItem label="Formatted number: ">
<mx:TextInput id="formattedNumber" editable="false" width="75%"/>
</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/Formatter.html