tags:

views:

25

answers:

1

Hi all,

I am using an accordian in which has three childs. Each child has some textInput elements. Now, i want to send data written in currently selected accordian's child's textInputs.

I have created a function "configure" which is called when someone clicks a button. That function checks as to which child of accordian is selected. Whichever is selected, the textInputs' text of that child are stored in locally defined variables.

Now, i have no idea how to pass these variable to the HTTPService i am sending at the end of function configure.

Can anyone tell me what should i do now or if there is any other efficient solution?

Thankyou

Codes:

private function configure():void
          {
            var selectedAlgos:Array = algosList.selectedItems;
         var selectedMode:Array;
            if (modeAccordian.selectedIndex == 0)
             {
              var N_interface:String = N_interface.text;
              var N_duration:String = N_duration.text;
              selectedMode.push(N_interface);
              selectedMode.push(N_duration);
             }
            else if (modeAccordian.selectedIndex == 1)
               {
                var F_filePath:String = F_filePath.text;
                var F_filePrefix:String = F_filePrefix.text; 
               }
            else if (modeAccordian.selectedIndex == 2)
             {
              var T_filePath:String = T_filePath.text;
              var T_filePrefix:String = T_filePrefix.text;
              var T_metaFile:String = T_metaFile.text;
              var T_toMergeFile:String = T_toMergeFile.text;
              var T_NAT:String = T_NAT.text;
              var T_NATIP:String = T_NATIP.text; 
             }
         configureService.send();

          }

HTTPService:

<mx:HTTPService id="configureService" url="configure.php" resultFormat="object" method="POST">
     <mx:request xmlns="">
            <selectedAlgos>{selectedAlgos}</selectedAlgos>
            <selectedMode>{selectedMode}</selectedMode>
      </mx:request>
    </mx:HTTPService>
A: 

According to the HTTPService docs:

public function send(parameters:Object = null):mx.rpc:AsyncToken

parameters:Object (default = null) 
An Object containing name-value pairs or an XML object, 
depending on the content type for service requests.

So I believe you can drop the mx:request section of your mxml, and just add this to the send request:

configureService.send(
   {
     selectedAlgos:selectedAlgos.join(","), 
     selectedMode:selectedMode.join(",")
   }
);

Otherwise, if you want to use binding, you should make the selectedAlgos/selectedMode bindable members of the same class that configure is defined in.

Glenn