Expand my Community achievements bar.

HTTP Service Using Results

Avatar

Level 1
I am trying to access data binded to an object from a result
of an httpservice. In the below example of the problem I am having,
if var = Info.XMLMainTag.XMLSubTag; is removed the httpservice
retrieves the data in lastresult and the Bind function is fired.
But if var = Info.XMLMainTag.XMLSubTag; is put in, the Bind
function is never called and from debugging it seems like the
httpservice is never executed as the lastresult object is always
null. I'm confused as to why this would happen? Any help is
appreciated, thanks!



<mx:Window xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" backgroundColor="#E7E7E7">



<mx:HTTPService id="httpCreateJob" url="
http://localhost/debug/php/CreateJob.php"
useProxy="false" method="POST" result="Bind(event);"/>

<mx:Button label="Create Job" click="fncCreateJob();"/>



<mx:Script>

<![CDATA[



import mx.rpc.events.ResultEvent;

public var Info:Object;



private function fncCreateJob():void {

httpCreateJob.send();



var Blah:String;

var = Info.XMLMainTag.XMLSubTag;

}



private function Bind(event:ResultEvent):void {

Info = event.result.CreateJobsResult;

}



]]>

</mx:Script>



</mx:Window>
1 Reply

Avatar

Level 3
Check aout if the http service on its own actually returns
something and also add a fault event to the http service so you can
get some info if there's something wrong with your call to the
httpservice.