Flex bind class property to mxml component
Is is possible to bind class properties to 开发者_运维知识库mxml components ?
E.g.: I have a class A.as
with a String
property nameValue
. What I want to achieve is always having the latest value of a mx:Text
component in nameValue
.
Thanks.
Sure, just do this (assuming Flex 3 from your use of the mx namespace):
<MyComponent ns="whateverNSyourclassisin">
<ns:A id="myInstanceOfA" />
<mx:Text id="myTextField" text="foo" />
<mx:Binding source="myTextField.text" destination="myInstanceOfA.nameValue" />
</MyComponent>
精彩评论