title: How to add dynamic objects to bindable ArrayCollection in Flex?
body: <p>I have an <code>ArrayCollection</code> that serves as dataprovider for a <code>TabBar</code>.
  Each item added must have two properties: a <code>label</code> and a <code>description</code>.</p>
  
  <p>I define these items dynamically as follows:</p>
  
  <pre><code>[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"});
  }
  
  
  &lt;s:TabBar dataProvider="{mybar}"&gt;
    &lt;s:ItemRenderer&gt;
      &lt;s:ButtonBarButton label="{data.label}" /&gt; //description might also be used here, but omitted
    &lt;/s:ItemRenderer&gt;
  &lt;/s:TabBar&gt;
  </code></pre>
  
  <p>Problem: as the properties "label" and "description" are not set <code>[Bindable]</code>, there is the following error log:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>How could I prevent this?</p>
  
  <p>The warning disappears if I use <code>ObjectProxy</code>:</p>
  
  <pre><code>mybar.addItem(new ObjectProxy( {label: "Test1", description: "long test test"}));
  </code></pre>
  
  <p>But is that correct?</p>