3 Replies Latest reply on Aug 27, 2008 7:17 AM by Newsgroup_User

    How to pass variables in Flex?

    braseth
      I have a form that calls an HTTPService (getEmployee), and that service uses the variable employeeID :

      <employeeID>{employeeID.text}</employeeID>

      In another state, I have a datagrid that from a different HTTPservice displays employeeID. From this datagrid, I want the user to click on the ID which will switch states and call my getEmployee HTTPService

      The only way I know to pass from this datagrid is to have my "getEmployee" HTTPservice reference
      <employeeID>{dgIncumbent.selectedItem.employeeID}</employeeID>. I cannot create a different service because other grids rely on the "getEmployee" data provider.

      What I need is to call the same "getEmployee" HTTPService, which accepts a value that is either "{dgIncumbent.selectedItem.employeeID}" or "{employeeID.text}".

        • 1. Re: How to pass variables in Flex?
          Level 7

          "braseth" <webforumsuser@macromedia.com> wrote in message
          news:g91l46$krf$1@forums.macromedia.com...
          >I have a form that calls an HTTPService (getEmployee), and that service
          >uses
          > the variable employeeID :
          >
          > <employeeID>{employeeID.text}</employeeID>
          >
          > In another state, I have a datagrid that from a different HTTPservice
          > displays
          > employeeID. From this datagrid, I want the user to click on the ID which
          > will
          > switch states and call my getEmployee HTTPService
          >
          > The only way I know to pass from this datagrid is to have my "getEmployee"
          > HTTPservice reference
          > <employeeID>{dgIncumbent.selectedItem.employeeID}</employeeID>. I cannot
          > create a different service because other grids rely on the "getEmployee"
          > data
          > provider.
          >
          > What I need is to call the same "getEmployee" HTTPService, which accepts a
          > value that is either "{dgIncumbent.selectedItem.employeeID}" or
          > "{employeeID.text}".
          >

          How bout

          [Bindable]
          public var eID:Number;

          private function onDgItemClick(e:ListEvent){
          eID = e.currentTarget.selectedItem.employeeID;
          }

          private function onEmployeeIDChange(e:TextEvent){
          eID = Number(employeeID.text);
          }

          Then bind your service to the variable.

          HTH;

          Amy


          • 2. Re: How to pass variables in Flex?
            braseth Level 1
            What does e.currentTarget. do?
            • 3. Re: How to pass variables in Flex?
              Level 7

              "braseth" <webforumsuser@macromedia.com> wrote in message
              news:g93g3e$8qm$1@forums.macromedia.com...
              > What does e.currentTarget. do?

              It's a reference to the "thing" the event listener was attached to. In this
              case, that would be your datagrid.

              HTH;

              Amy