An HTTPService call will return a value if the server process writes
back a response.
You can set the resultFormat="text". I have never done this since I
always wrap my returned data in a status node: <returnstatus
status="success", stausdescription="" >MyData</returnstatus>
This give me a consistent data structure to work with even if there is a
problem on the server.
Retrieve you data and process it however you want in the timingSaved()
handler.
Private function timingSaved(event.ResultEvent):void
var xmlResult:XML = event.result as XML;
var sStatus:String = xmlResult.attribute("status");
if (sStatus == "success") {
_sUId == xmlResult.text(); //set your instance var value or whatever
}
else {
Alert.show(xmlResult.attribute("statusdescription")"Server Error");
Tracy
________________________________
From: [email protected] [mailto:[email protected]] On
Behalf Of wkolcz
Sent: Thursday, December 18, 2008 12:26 PM
To: [email protected]
Subject: [flexcoders] Passing a varibable back to ActionScript via
HTTPRequest
I have a CF page that generates a Unique ID (UUID). I have an
HTTPRequest passes information to a CF page and I want it to generate
the number and then return it to ActionScript where it can use it as a
local variable. Any idea on how to do that?
Does the HTTPRequest return a value? Does it have to be in XML?
Would I set the returned value in the resulthandler? Here is what I have
for a HTTPRequest:
private function startTrackIt(trackInfo:Object):void {
var service:HTTPService = new HTTPService();
service.url = "tracker.cfm"; //Dev
service.method = "POST";
service.addEventListener(ResultEvent.RESULT, timingSaved);
service.addEventListener(FaultEvent.FAULT, alertFault);
service.send(trackInfo);
}
What would I need to do next to set a local variable in my AS? In a
RemoteObject, I usually set the a variable, typed ArrayCollection, in
the ResultHandler.
Sorry, this little idea is all new me and I am trying to figure it out.
OR Can Flash create a unique number like ColdFusion?