I am creating a RSS Feed application based on a data, and I have the following:
I have an ArrayCollection that is pre-populated with data. I am sorting through the ArrayCollection, get 1 piece of data (condition), and need to connect to an RSS feed which returns me the title, and I set my ArrayCollection in correspondence to condition -> title.
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);
}
Basically, I want to iterate through the list ArrayCollection, and update list.getItemAt(i).title with result passed from the HTTPService.
This doesn't work! Help!
First make a result event on httpservice in that only you will access the result for the request.
In that method you will get resultEvent from that take out the required value if it return the response as xml you can directly do like this 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>
here is an example http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_2.html#193905