일치하지 않는 유형의 등록 정보에서 양방향 데이터 바인딩을 수행하는 간단한 방법은 없습니까? 아래의 예에서 나는 서로 두 가지 속성을 결합하려고했다 : 유형 String
(s:TextInput
에서 text
속성) 중 하나를 입력 Number
의 다른 (Foo
에서 bar
속성)일치하지 않는 유형의 등록 정보에서 Flex 4 양방향 데이터 바인딩
package com.example
{
public class Foo
{
[Bindable] public var bar:Number;
}
}
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:ex="com.example.*"
>
<fx:Declarations>
<ex:Foo id="foo" />
</fx:Declarations>
<s:TextInput text="@{foo.bar}" /><!-- error at this line -->
</s:Application>
이 코드 결과를 컴파일 시도 다음과 같은 오류 :
1067: Implicit coercion of a value of type String to an unrelated type Number.
오류가 발생하는 이유는 이해하지만 나는 간의 변환에서 시도를 허용 것이 뭔가 (플렉스 4 메타 데이터의 아마 일종)의 단순 무식 해요 경우 궁금 해서요 티 유형과 같은 변환이 실패 할 경우 런타임 오류를 던지고 ... 우와