Binding to the members of the parent class

This is not an obvious fact and this is not mentioned anywhere in the documentation: to bind to the member of the parent class both (child & parent classes) should be declared as [Bindable].

Here is the example:

public class Parent
{
public var m_sText:String;

public function Parent()
{
}
}

[Bindable]
public class Child extends Parent
{
public function Child()
{
super();
}
}
 

If you don’t specifically tell to compiler that class Parent is bindable, compiler will give you the infamous warning on the attempt to bind to any public member of the Parent class:

Data binding will not be able to detect assignments to "m_sText".

P.S. It is logical if you think about the meaning of the [Bindable] directive and and you know the fact that PropertyChange events is not fired for changes happened inside of the complex members.

Leave a Reply