2 Replies Latest reply on Oct 9, 2007 10:56 AM by ctzn99

    BindingUtils Question

    ctzn99 Level 1
      Ok, so quite often I find myself databinding properties of a group of controls to a boolean value. For example I will have a group of text input boxes that are hidden, then when a user pushes a button i change a boolean value once and the entire group of edit boxes become visible because their visible property is bound to the boolean value.


      [Bindable] var editing:Boolean = false;

      <mx:TextInput visible="{editing}" />

      Additionally, sometimes i will have two controls that essentially toggle.

      <mx:Label visible="{!editing}" />
      <mx:TextInput visible="{editing}" />

      So then changing the editing variable will hide one control and show the other (i can also use the same binding on the include in layout property). The important thing to notice here is the " ! ". This gives you the opposite value of whatever boolean it's in front of.

      So here's my question. Does anyone know how I can make the ! symbol work when using the BindingUtils helper class?

      This works:
      BindingUtils.bindProperty(myLabel, "visible", this, "editing");

      But this doesn't:
      BindingUtils.bindProperty(myLabel, "visible", this, "!editing");

      So, in the case of predefined mxml components I can use the ! symbol in the databinding but, if i dynamcially create a control and then try to use the ! symbol in my databinding i get an "Property !editing not found on blah blah blah".