Not Understanding Basics Of Dynamic DataBinding (bindPropety) In Flex
- by Joshua
I need to dynamically bind properties of components created at runtime.  In this particular case please assume I need to use bindProperty.  
I don't quite understand why the following simplistic test is failing (see code).  When I click the button, the label text does not change.  
I realize that there are simpler ways to go about this particular example using traditional non-dynamic binding, but I need to understand it in terms of using bindProperty.
Can someone please help me understand what I'm missing?
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="Tools.*" minWidth="684" minHeight="484" xmlns:ns2="*" creationComplete="Init();">
  <mx:Script>
    <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.binding.utils.*;
      public var Available:ArrayCollection=new ArrayCollection();
      public function get Value():String {
        return (Available.getItemAt(0).toString());
      }
      public function Init():void {
        Available.addItemAt('Before', 0);
        BindingUtils.bindProperty(Lab, 'text', this, 'Value');
      }
      public function Test():void {
        Available.setItemAt('After', 0);
      }
    ]]>
  </mx:Script>
  <mx:Label x="142" y="51" id="Lab"/>
  <mx:Button x="142" y="157" label="Button" click="Test();"/>
</mx:WindowedApplication>
Thanks in advance.