我在使用Flex框架一个Flash应用程序 - 我想用数据的显示对象textField的从我的数据模型绑定。 如何做到这一点,而不挠结合括号{}
I have a flash app using the flex framework - I would like to bind a display object textField with data from my dataModel. How do I do this without the flex binding brackets "{ }"
在此先感谢大家。
要做到这一点最简单的方法是使用 BindingUtils
类。例如,假设你有一个对象富
财产吧,你要绑定到你的文本区域的文本
财产;所有你需要做的就是在您的ActionScript如下:
The easiest way to do this is to use the BindingUtils
class. For example, say you have an object foo
with property bar
that you want to bind to your text area's text
property; all you need to do is the following in your ActionScript:
BindingUtils.bindProperty( myTextArea, "text", foo, "bar" );
这会告诉Flex的观看富
的任何更改属性栏
,并在发生变化,复制该值 myTextArea.text
。
This will tell Flex to watch foo
for any changes to the property bar
, and when changes occur, copy the value to myTextArea.text
.
完整文档,可以发现这里