httpserviceを使用した配列の居住
-
13-09-2019 - |
質問
データに基づいてRSSフィードアプリケーションを作成していますが、以下があります。
データが事前に入力された配列があります。 ArrayCollectionを並べ替え、1つのデータ(条件)を取得し、タイトルを返すRSSフィードに接続する必要があり、条件 - >タイトルに対応して配列コレクションを設定します。
public function updateArrayList(list:ArrayCollection):ArrayCollection {
trace(list);
for(var i:int = 0; i < list.length; i++) {
// Alert.show(list.getItemAt(i).condition);
getRSSUpdate(list.getItemAt(i).condition);
list.getItemAt(i).title = getRSS.lastResult.article.title;
}
return list;
}
public function getRSSUpdate(condition:String):void {
getRSS = new HTTPService();
getRSSParam = new Object;
getRSSParam.condition = condition;
getRSS.method = "POST";
getRSS.url = "http://localhost/site/remoteRequests/flash/rss/getRSS.php";
getRSS.send(getRSSParam);
}
基本的に、リストArrayCollectionと更新リストを繰り返し、getItemat(i)。結果がhttpserviceから渡されます。
これはうまくいきません!ヘルプ!
解決
最初にhttpserviceで結果イベントを作成します。これは、リクエストの結果にアクセスするだけです。
その方法では、XMLとして応答を返す場合、必要な値を取得することから結果を得ることができます。 lastresult.article.title
<mx:HTTPService id="yahooHTTPService"
url="http://search.yahooapis.com/WebSearchService/V1/webSearch"
method="GET"
makeObjectsBindable="true" result="httpServiceResult(event)"
fault="httpServiceFault(event)" showBusyCursor="true">
</mx:HTTPService>
これが例です http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_2.html#193905
所属していません StackOverflow