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: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of sof4real03
Sent: Monday, April 24, 2006 9:03 PM
To: [email protected]
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




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to