Dude, you need a ChangeEvent for a getter unless you’re sure it will be right the first time J

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Stacy Young
Sent: Saturday, July 30, 2005 6:58 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Binding to properties?

 

Ah, left that meta in there by accident, was messing around. It’s not being dispatched.

As for the ModelLocator, yes, formSection is typed as a FormSection. IsValid property registers as “false” when the view is initialized (as it should) yet when the property changes to “true”. Da button, she’s broke, won’t enable.

 

public static var selectedFormSection :FormSection = new FormSection();

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin
Sent: Saturday, July 30, 2005 9:49 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Binding to properties?

 

Who’s dispatching the “change” event?  And does ModelLocator have formSection typed as a FormSection?  Or is it just a static variable of unknown type?

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Stacy Young
Sent: Saturday, July 30, 2005 6:38 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Binding to properties?

 

Is it not possible to bind the enabled attribute of a button to a property? As the property changes the state of the button remains disabled i.e.

 

<mx:Button id="saveButton" label="Create Section" height="22"

enabled="{ModelLocator.formSection.isValid}"

            click="sectionViewHelper.submitForm()" />

 

FormSection reference:

 

import org.nevis.cairngorm.vo.ValueObject;

 

class com.optimal.raven.vo.FormSection implements ValueObject

{

      public static var regClass = Object.registerClass( "com.optimal.raven.application.resource.data.FormSection", com.optimal.raven.vo.FormSection );

     

      public var code : String            = "";

      public var description : String     = "";

      public var languageDetails : Array = new Array();

      public var active : Boolean         = true;

 

      public function FormSection()

      {

      }

 

//----------------------------------------------------------------------------

     

      [ChangeEvent("change")]

      public function get isValid() :Boolean

      {

            if(description.length && languageDetails.length)

            {

                  for(var i:Number=0; i < languageDetails.length; i++)

                  {

                        if(!languageDetails[i].isValid){

                              trace("FormSection FALSE DETAIL");

                              return false;

                        }

                  }

                  trace("FormSection TRUE");

                  return true;

            } else {

                  trace("FormSection FALSE");

                  return false;

            }

      }

 

}

 

Cheers,

Stace






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to