yigit escreveu:
> hi all;
> i have a custom class which has a toString method; so i can directly use 
> it as a source to textInput's text field.
> i want to make binding work, i mean when the result of the toString 
> changes, i want the view to update itself automatically.
> nameID field of roleRef is an instance of my class that implements 
> toString with function biding.
> when i use this way:
> <mx:Label id="lbl" text="{roleRef.nameID}"/>
> function binding on toString does not work
> when i use this way:
> <mx:Label id="lbl" text="{roleRef.nameID.toString()}"/>
> function biding on toString works, but inside an item renderer, it does 
> not work.
> <mx:Label id="lbl" text="{data.nameID.toString()}"/>
>
>
> is this a compiler bug or is this the normal behavior?
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
>
>
>
>
> __________ NOD32 2747 (20071225) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>   
I believe you can only bind vars and setters. By binding a function i 
think it will only execute the function once. An easy workaround is to 
have a var containg the result of the toString function and bind the 
property to that var. Something like:

[Bindable] public var stringValue:String = "";
public function toString():String {
    stringValue= this.toString();
    return stringValue;
}

<mx:Label id="lbl" text="{data.nameID.stringValue}"/>

Regards

Frederico Garcia

Reply via email to