I'm at a loss here, Anybody having any issues with binding in States?

--- In flexcoders@yahoogroups.com, "sof4real03" <[EMAIL PROTECTED]> wrote:
>
> After tracing my code, I'm sure that the event is being propagated,
> but the button still doesn't become enabled even when the forms are
> valid. Could it be the issue of creating this state on the component's
> parent?
>
> --- In flexcoders@yahoogroups.com, "sof4real03" <soubraham2@> wrote:
> >
> > You are correct, the formsValidationChange event is bound for the
> > formvalid property of the component.
> >
> > [ChangeEvent("formValidChanged")]
> > public function get formValid():Boolean
> > {
> >       return _formValid;
> > }
> >            
> > public function set formValid( formValid:Boolean ):void
> > {
> >       setFormValid( formValid );
> > }
> >
> > private function setFormValid( formValid:Boolean ):void
> > {
> >       if ( formValid != _formValid )
> >       {
> >             _formValid = formValid;
> >             dispatchEvent(new Event("formValidChanged"));
> >       }
> > }
> >
> >
> > I've put Alerts in the formsValid function and it's getting to the
> > function, but it doesn't seem to be recieving the
> > "formValidationChange" event everytime it's set to a new value. I'm at
> > a loss...
> >
> > If I don't use a state and put in this button on the page initially
> > all is good.
> > --- In flexcoders@yahoogroups.com, "Matt Chotin" <mchotin@> wrote:
> > >
> > > What is formValidationChanged the event on?  The formValid
property I
> > > hope?  Are you sure you're not going into the formsValid method?
Try
> > > naming the arguments array to something different like args,
arguments
> > > is a reserved word and may be acting funky here (though it
should work
> > > correctly in this case I think).
> > >
> > > Matt
> > >
> > > -----Original Message-----
> > > From: flexcoders@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On
> > > Behalf Of sof4real03
> > > Sent: Monday, April 24, 2006 9:03 PM
> > > To: flexcoders@yahoogroups.com
> > > Subject: [flexcoders] mx:States and databinding issue
> > >
> > > I have a custom form component that broadcasts an event every
time the
> > > form changes validation states:
> > >
> > > ContactDetails.mxml:
> > >
> > > [ChangeEvent("formValidationChanged")]
> > >
> > > Now the parent component of "ContactDetails" is
> > > CreateClientProfile.mxml and it uses an accordian to instantiate the
> > > ContactDetails form.
> > >
> > > Finally "CreateClientProfile" is a state of another component.
> > >
> > > Ok, so in ContactDetails, I have the following code:
> > >
> > > <mx:states>
> > > <mx:State name="default" id="defaultCCView">
> > > <mx:AddChild target="{parentDocument.clientPanelControl}">
> > > <mx:Button id="addClientBtn" label="Add My Client"/>
> > > </mx:AddChild>
> > > <mx:SetProperty target="{addClientBtn}" name="enabled" value="{
> > > formsValid(personalDetails.formValid,contactDetails.formValid) }"/>
> > > <mx:SetEventHandler target="{addClientBtn}" name="click"
> > > handler="submitClientForm()"/>
> > > </mx:State>
> > > </mx:states>
> > >
> > > <mx:Script>
> > > <![CDATA[
> > >            
> > > public function formsValid(...arguments:Array):Boolean
> > > {
> > >  for(var i:int = 0; i < arguments.length; ++i)
> > >  {
> > >   if( arguments[i] == false )
> > >   {
> > >     return false;
> > >   }
> > >  }
> > >  return true;
> > > }
> > >
> > > So, in the CreateClientProfile.mxml, I create a button on it's
parent
> > > container, ClientPanel.mxml.
> > >
> > > ClientPanel -> CreateClientProfile -> ContactDetails
> > >
> > > Eventhough I'm broadcasting the "FormValidationChange" event
from the
> > > ContactDetails component it doesn't get picked up from the state
that
> > > creates the button though it's using databinding on the formsvalid
> > > function. Any insight?
> > >
> > > Thanks,
> > > Sof
> > >      
> > >
> > >
> > >
> > >
> > >
> > > --
> > > 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
> > >
> >
>






--
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