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




Reply via email to