Apache flex 使用HTTPService填充ArrayCollection
我正在基于数据创建RSS提要应用程序,我有以下内容: 我有一个预先填充了数据的ArrayCollection。我正在对ArrayCollection进行排序,获得1条数据(条件),需要连接到一个RSS提要,该提要返回标题,我将ArrayCollection设置为condition->titleApache flex 使用HTTPService填充ArrayCollection,apache-flex,httpservice,arraycollection,Apache Flex,Httpservice,Arraycollection,我正在基于数据创建RSS提要应用程序,我有以下内容: 我有一个预先填充了数据的ArrayCollection。我正在对ArrayCollection进行排序,获得1条数据(条件),需要连接到一个RSS提要,该提要返回标题,我将ArrayCollection设置为condition->title public function updateArrayList(list:ArrayCollection):ArrayCollection { trace(list
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);
}
public函数updateArrayList(list:ArrayCollection):ArrayCollection{
跟踪(列表);
对于(变量i:int=0;i
基本上,我希望遍历list ArrayCollection,并使用从HTTPService传递的结果更新list.getItemAt(I).title
这不行!救命啊 首先在httpservice上生成一个结果事件,因为只有您才能访问请求的结果 在该方法中,您将从中获得resultEvent,如果它以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>
这里有一个例子这不是我想要的。我有一个预先填充了数据的ArrayCollection。我正在对ArrayCollection进行排序,得到一条数据(条件),需要连接到一个RSS提要,该提要返回一点数据(标题),我的ArrayCollection中填充了条件->标题。