5 Replies Latest reply on Nov 4, 2007 11:30 PM by Giribabums

    how to pass a value from 1 mxml componet to the another mxml componet

    Giribabums
      I have created 3 mxml components. I am using 1st component as a container component for other 2 components mean[ inside 1st component i have placed 2 other components]. now i want to pass selectedvalue from 1 component to another component.

      say 1st component is MyFirstComponent.mxml
      2nd component is MySecComponent.mxml
      3rd component is MyThirdComponent.mxml

      now i have place 2nd & 3rd component in 1st component. whenever i select an item from dropdown in 2nd component i want to set/pass that selectedvalue to 3rd component public variable. how can i achieve this.

      MySecondComponent.mxml
      [code]
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml"
      xmlns:salesforce=" http://www.salesforce.com/" creationComplete="login()">
      <mx:ComboBox x="102" y="26" id="ddlDepartmentName" cornerRadius="2" height="20"
      fontWeight="bold" width="148"/>
      </mx:Canvas>
      [/code]

      MyThirdComponent.mxml
      [code]
      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:salesforce=" http://www.salesforce.com/" creationComplete="login();">
      <mx:Script>
      <![CDATA[
      import SubComponents.Department.DepartmentSummary;

      public var departmentID:String = 10;
      ]]>
      </mx:Script>
      </mx:HBox>
      [/code]

      right now i am using hardcoded departmentID in 3rd component, i want to remove the hardcoded value and i want to set the value from 2nd components' on selectionChange.

      When i select department Name from the comboBox which is created in 2nd component i want to get the value in 3rd component. how can i achive this..

      want to set the departmentID in 3rd component to the ddlDepartmentName.selectedValue in 2nd component. when i change the selected value in 2nd component i want to display the department information in 3rd component after setting the departmentID
      Waiting for your valuable answer.