I have an ArrayCollection that serves as dataprovider for a TabBar.
Each item added must have two properties: a label and a description.
I define these items dynamically as follows:
[Bindable] //required to serve as data provider
private var mybar:ArrayCollection;
public function init() {
mybar = new ArrayCollection();
mybar.addItem({label: "Test1", description: "long test test"});
}
<s:TabBar dataProvider="{mybar}">
<s:ItemRenderer>
<s:ButtonBarButton label="{data.label}" /> //description might also be used here, but omitted
</s:ItemRenderer>
</s:TabBar>
Problem: as the properties "label" and "description" are not set [Bindable], there is the following error log:
warning: unable to bind to property 'label' on class 'Object' (class is not an IEventDispatcher)
warning: unable to bind to property 'description' on class 'Object' (class is not an IEventDispatcher)
How could I prevent this?
The warning disappears if I use ObjectProxy:
mybar.addItem(new ObjectProxy( {label: "Test1", description: "long test test"}));
But is that correct?
ButtonBarButtonwhich is part ofspark.components.ObjectProxythe warning disappears, but I don't know if that's the right way...