tags:

views:

164

answers:

2

Hello,

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.

+1  A: 

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>
macke
`<ns:A id="myInstanceOfA"/>` `<mx:Text text="foo" id="myTextField"/>`
Amarghosh
Ah yes, must've been in a rush, thanks!
macke
A: 

This is a nice link for bi-directional data binding-

http://devgirl.wordpress.com/2009/11/18/651/

Keshav