1 Reply Latest reply on Jul 19, 2010 4:21 AM by rootsounds

    dynamic definition of binding expression.

    Fred in Orlando

      I can use a standard textInput like this:

       

      <mx:TextInput   text="{Root.elementA}" \>

       

      and this works well, when I use an HttpService to replace Root, the TextInput is updated.  However...

       

      I have defined my own custom fields, which take a "tag" attribute that allows them to update the server when they are changed.  Thus I have

       

      <my:FredsTextInput tag="A0500C"/>  and I would really like to bind to the data WITHOUT repeating text="{Root.A0500C}" for each element.  I've got about 500 elements.  I have tried all the different definitions I can think of for FredsTextInput with no success.  Does Anyone have a solution?  If it matters, I'm using Flex 4 and here is my latest failure, which just shows  "{Globals.AssessmentData.A1300B}" in the TextInput field.

       

      <mx:TextInput xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:com="components.*"
                   change="{AssessmentService.saveChanges(id,event.target.selectedItem.value)}"      >
      <mx:Script>
          <![CDATA[
              [Bindable] private var _tag:String = "undefined"
             
             
              public function set tag(name:String):void {
                  //Globals.log("setting tag on checkbox "+name);
                  _tag=name;
                  var longname = "{Globals.AssessmentData."+name+"}";
                  super.text = "{Globals.AssessmentData.A1300B}";
                  toolTip = name +"="+ super.text;           
              }
             
             
          ]]>
      </mx:Script>
         
      </mx:TextInput>