Flex 4 XML Attribute Binding Not Working?
For some reason this seems to no longer work in flex 4开发者_如何学C, it used to work in flex 3...
[Bindable]
public var xmlTitle:String = "TEST";
[Bindable]
public var xmlData:XML = <Data title={xmlTitle}> ... </Data>;
I am setting the xmlTitle variable outside of the component:
<local:Comp xmlTitle="Some Title" />
I have tried with getter / setters...etc. It just does NOT update when changing, it shows the default value and never changes. Is this a known new bug in flex 4?
I can't say I've ever done that before, mostly because it's extremely bad form. If you want to create an xml, using the XML object in mxml to create it in the declarations:
<fx:Declarations>
<fx:XML id="xmlData" xmlns="">
<Data title="{xmlTitle}">
</Data>
</fx:XML>
</fx:Declarations>
Should work just fine.
Using {}
with XML in ActionScript is not data binding. It takes current variable's value in the moment of forming XML. And doesn't change it later. So this behavior is absolutely expectable.
精彩评论