은 HTTP 요청이 완료된 후 (성공 및 오류)을 수행 한 후 HTTPService 객체의 참조를 검색 할 수 있음을 다른 사람이 알 수 있습니까? 다음은 HTTP 요청을 저장하는 간단한 테스트 응용 프로그램입니다. 응답 ("httpResult"및 "httpFault"기능)을 처리 할 때 어떤 호출이 성공/실패했는지 검색 할 수 없습니다.Flex HTTPService : 요청을 보낸 서비스를 검색하십시오.
항상
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
initialize="init(event);">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
private var calls:Array;
private function init(event:FlexEvent):void{
calls = new Array();
// working HTTP Call
test('http://v4.ipv6-test.com/api/myip.php');
// not working HTTP Call
test('http://unknown.web.site.com/');
}
private function test(URL:String):void{
var service:HTTPService = calls[ calls.push(new HTTPService()) - 1];
service.url = URL;
service.method = 'GET';
service.addEventListener("result", httpResult);
service.addEventListener("fault", httpFault);
service.send();
}
private function httpResult(e:ResultEvent):void{
for(var i:int = calls.length; i>=0; i--){
if(calls[i]==e.target || calls[i]==e.currentTarget){
trace('Successful HTTP call found #' + i);
return;
}
}
trace('Successful HTTP call not found :(');
}
private function httpFault(e:FaultEvent):void{
for(var i:int = calls.length; i>=0; i--){
if(calls[i]==e.target || calls[i]==e.currentTarget){
trace('Unsuccessful HTTP call found #' + i);
return;
}
}
trace('Unsuccessful HTTP call not found :(');
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Placer ici les éléments non visuels (services et objets de valeur, par exemple). -->
</fx:Declarations>
</s:WindowedApplication>
중복 것 같은데 : http://stackoverflow.com/questions/3009010/httpservice-resultevent- 플렉스 -3-2 대 플렉스 3-5 – Simmoniz