Flex:在某些条件下将数据传递到php文件

时间:2009-10-28 07:11:31

标签: flex

我正在使用一个有三个孩子的手风琴。每个孩子都有一些textInput元素。现在,我想发送用当前选择的手风琴子的textInputs编写的数据。

我创建了一个功能“configure”,当有人点击按钮时会调用该功能。该功能检查选择了哪个手风琴子。无论选择哪个,该子项的textInputs文本都存储在本地定义的变量中。

现在,我不知道如何将这些变量传递给我在函数configure末尾发送的HTTPService。

任何人都可以告诉我现在应该做什么或者是否有其他有效的解决方案?

三江源

代码:

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>

1 个答案:

答案 0 :(得分:0)

根据HTTPService文档:

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.

所以我相信您可以删除mxml的mx:request部分,然后将其添加到send请求中:

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

否则,如果要使用绑定,则应使selectedAlgos / selectedMode可绑定成员在同一个类中定义configure