Try using
private function init(): void {
new Binding(this,
function():String { return xml.label },
function(value:String):void { txtDemo.text = value },
"txtDemo.text");
}
It worked for me.
-Sreenivas
--- In [email protected], "xyjaws" <[EMAIL PROTECTED]> wrote:
>
> The question is: Howto dynamicly bind XML element to a TextInput
> component using BindingUtils?
>
> Now I use following codes:
> <!--
> [Bindable] private var xml: XML = <item><label>list1</label></item>;
>
> // initialize code for application's initialize event
> private function init(): void {
> BindingUtils.bindProperty(txtDemo, "text", xml, "label");
> }
>
> //click event
> private function test(): void {
> xml.label = "something";
> // txtDemo.executeBindings(); //---- no use anymore
> }
> -->
> <mx:TextInput id="txtDemo"/>
> <mx:Button label="Test" click="test()"/>
>
> //--------------------------------------
> My really idea is when bindable xml property is changed, then the
> textinput will be updated as hoped. However, no update happens to
me
> when I click the Test button.
>
> But, if I make codes like that:
> <mx: TextInput id="txtDemo" text="{xml.label}"/>
> the text will updated when xml changs.
>
> So, what happened, I indeed need the dynamicly bind to the
textinput
> compont.
> Help me. thanks.
>