views:

103

answers:

1

hi - say that i have a base class called Base, that is Bindable and has a String property like this:

[Bindable]
public class Base
{
    public var msg:String;

}

Now, there is a class called Derived:

[Bindable]
public class Derived extends Base
{
}

i am trying to bind to a mxml component like this:

[Bindable]
private var d:Derived = new Derived();


<mx:Binding source="d.msg" destination="msg.text" />

where msg is some textInput field. I am getting a message from the compiler that....

Data binding will not be able to detect assignments to "msg"

is there a limitation with data binding to a base class? what am i doing wrong?

A: 

Try turning this into property with getters and setters

public class Base 
{
    protected var _msg:String;

    [Bindable]
    public function get msg():String 
    {
        return _msg;
    }

    public function set msg(val:String):void 
    {
        _msg = val;
    }
}
artemb
i am almost too embarrassed to report that a clean of the project and rebuild solved the problem - sorry for having wasted your time and thanks anyways artemb
onn
This won't do anything different than declaring a specific "var" as [Bindable] in the class.
cliff.meyers