|
Here is a sample app. Note: change the url to the xml source file to match yours. Tracy <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="dsVideos.send();"> <mx:Script><![CDATA[ import mx.rpc.events.ResultEvent; private function onResult(oEvent:ResultEvent):void { taXML.text = oEvent.result.toString(); }//onResult
]]></mx:Script> <mx:HTTPService id="dsVideos" url="" result="onResult(event)" resultFormat="e4x"/> <mx:TextArea id="taXML" width="500" height="200" /> </mx:Application> From: [email protected] [mailto:[email protected]] On Behalf Of Tracy Spratt lastResult is only for binding expressions. You still use event.result in a handler function.
What is the resultFormat of the HTTPService? If it is object, toString() might not give you anything useful.
For that matter, when you say “doesn’t work”, exactly what do you mean?
Tracy
From: [EMAIL PROTECTED]oups.com [mailto:[EMAIL PROTECTED]oups.com] On Behalf Of Cathy Reilly
In Flex 2, you need to use 'event.lastResult'
- Cathy
From: [EMAIL PROTECTED]oups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Robin Burrer Hi there, I started playing around with the HTTP service. However I can’t figure out how to access the actual “result” (in my case an xml string) If I set up a listener it just returns me an object in the “onResult” event. Why can’t I access my xml string through “event.result”? How do I access it? public function onResult(event:ResultEvent):void { // why doesn’t this work? trace (event.result.toString()); // this works but it’s very ugly //trace(event.message.body.toString()); }
Thanks Robin // the code of my sample application <?xml version="1.0"?> <!-- Simple example to demonstrate the HTTPService tag. --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="go();"> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent;
public function go():void {
feedRequest.addEventListener(ResultEvent.RESULT,onResult); feedRequest.send(); }
public function onResult(event:ResultEvent):void { trace (event.result.toString()); //trace(event.message.body.toString()); }
]]> </mx:Script>
<mx:HTTPService id="feedRequest" url="" href="http:/">http://weblogs.macromedia.com/mchotin/index.xml" useProxy="false" />
</mx:Application> __._,_.___ Messages in this topic (3) Reply (via web post) | Start a new topic --
Recent Activity · 95 SPONSORED LINKS · Software development tool
Find Deals Compare prices and find great discounts. Y! GeoCities Show off your talent and skills. Yahoo! HotJobs Employers find you Upload your resume .
-- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
__,_._,___ |
Title: RE: [flexcoders] newbie question - HTTP servive

