How do I use Flex's Binding in a Flash AS3 project

孤街浪徒 提交于 2019-12-11 15:48:25

问题


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 "{ }"

Thanks in advance everyone.


回答1:


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" );

This will tell Flex to watch foo for any changes to the property bar, and when changes occur, copy the value to myTextArea.text.

Full documentation can be found here.



来源:https://stackoverflow.com/questions/2592506/how-do-i-use-flexs-binding-in-a-flash-as3-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!