首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用HTTPService填充ArrayCollection

使用HTTPService填充ArrayCollection
EN

Stack Overflow用户
提问于 2009-07-14 05:44:25
回答 1查看 2K关注 0票数 0

我正在基于数据创建一个RSS Feed应用程序,并且我有以下内容:

我有一个预先填充了数据的ArrayCollection。我正在对ArrayCollection进行排序,获取1条数据(条件),需要连接到一个返回标题的RSS feed,并将我的ArrayCollection设置为与条件->标题相对应。

代码语言:javascript
复制
        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,并使用从HTTPService传递的结果更新list.getItemAt(i).title。

这不管用!帮助!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-07-14 10:39:38

首先在httpservice上创建一个结果事件,因为只有您才能访问请求的结果。

在该方法中,您将从所需值中获取resultEvent,如果它以xml形式返回响应,则可以直接像下面这样做

代码语言:javascript
复制
<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示例

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1123630

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档