2 Replies Latest reply on Jul 1, 2010 4:36 AM by Aron manager

    Binding not working for Property func set/get but working for instance var

    Aron manager Level 1

      Hi,

       

      I am a bit messed up. I have this class (showing just important part):

       

      [Bindable]
           public class FormValidator extends EventDispatcher
           {
                public var formIsValid:Boolean = false;
       
                public var validators:Array;
       
                public function FormValidator(target:IEventDispatcher=null)
                {
                     super(target);
                }
       
                public function get valid() : Boolean
                {
                     return formIsValid;
                }
                public function set valid(val:Boolean) : void
                {
                     formIsValid=val;
                }
      

       

      then in my mxml I have a button that changes its enable propety based on the valid property. Well the binding works if I make the enable property bind directly to "formIsValid" and doesn't work if I bidn directlyh to the property "valid", I mean:

       

      <mx:button enabled="{formValidator.formIsValid}" /> Works

      <mx:button enalbed="{formValidator.valid}" /> Doesn't work.

       

      I have been reading thte docs at adobe site abount binding but it seems I'm not doing anything special. Could anybody give any tip?

       

      Thanks in advance,

      Aron