Flex 调用 Action

来源:互联网 发布:白银td交易软件 编辑:程序博客网 时间:2024/06/02 00:27

1.设置数据源(动态传递参数):

<s:HTTPServiceid="httpServiceSend" fault="httpServiceSend_faultHandler(event)" result="httpServiceSend_resultHandler(event)" useProxy="false">       <s:request>             <id>{transformationId}</id>             <step>{step}</step>             <runFlag>{runFlag}</runFlag>             <fileName>{fileName}</fileName>             <dateFlag>{dateFlag}</dateFlag>       </s:request> </s:HTTPService>

2.设置出现异常的方法:

protected function httpServiceSend_faultHandler(event:FaultEvent):void{      Alert.show(event.fault.messageasString, "提示");} 

3.设置回调的方法:

protected function httpServiceSend_resultHandler(event:ResultEvent):void{      varresult:String = event.resultasString;      if(result == "SUCCESS"){            Alert.show( "操作成功!", "提示");      } else{            Alert.show("出现错误!", "提示");      }} 

4.动态调用数据源提交数据:

private function sendData(event:MouseEvent):void{      dateFlag = newDate().toString();      method = "getData";      httpServiceSend.url = "http://localhost:8080/FlexDataServer/action/data.action";      httpServiceSend.send();}
原创粉丝点击