actionscript 3 - Flex 4 two-way data binding on properties of non-matching types -
is there no simple way perform two-way data binding on properties of non-matching types? in example below trying bind 2 properties each other: 1 of type string
(text
property s:textinput
) , other of type number
(bar
property foo
)
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 @ line --> </s:application>
attempting compile code results in following error:
1067: implicit coercion of value of type string unrelated type number.
i understand why error happens, wondering if i'm ignorant of (perhaps sort of flex 4 metadata) allow attempt @ conversion between 2 types , throwing run-time error if such conversion fails...
the thing able come change type of property bar
in foo
*
(star wild card, prevents type checking @ compile time). i'd still know if there's way keep type...
Comments
Post a Comment