[flexcoders] POST vs GET vs SEND ...not the same inside Flex

2007-10-28 Thread i.yoho
The more I play with this, the more I am convinced that it is acting
wrong because of Flex. I am watching the Apache server access.log as
the data goes by. And I just can't figure this out. My apologies for
the cross-post with Flash-Tiger group but I haven't heard anything and
thought it might be more appropriate here if Flex is causing the error.

I am working from the example in the Actionscript 3 cookbook chapter
20.13 trying to learn how to properly send XML data to a server-side
script. I have tried this a couple ways but haven't been able to get
past xml parsing errors with the basic HTTPService send. And to
compound matters, I am trying to learn Flex at the same time.

This code is from chapter 20.13 but to get any data to pass I have to
switch it from a .POST to a .GET. From what I have read, the .POST is
the right way. Has anybody been through this? Any advice greatly
appreciated.


var request:URLRequest = new URLRequest( "/saveResults.php" );
// Set the data property to the dataToSave XML instance to send
the XML
// data to the server
request.data= dataToSave;
// Set the contentType to signal XML data being sent
request.contentType = "text/xml";
// Use the post method to send the data
request.method = URLRequestMethod.POST;

// Create a URLLoader to handle sending and loading of the XML data
var loader:URLLoader = new URLLoader( );
// When the server response is finished downloading, invoke
handleResponse

loader.addEventListener( Event.COMPLETE, handleResponse );
// Finally, send off the XML data to the URL
loader.load( request );
}

Thanks,
Imogene



[flexcoders] Error with HTTPService POST making malformed element

2007-10-25 Thread i.yoho
I am new to Flex and need help with getting the appropriate containers
set up to send GOOD data from a swf to PHP to do the write to an XML file.

// The beginning of the error is...
[RPC Fault faultString="Error #1090: XML parser failure: element is
malformed." 

// The beginning of the string that gets passed according to the
Apache access log...
?param2=%3Cplayer%20type%3D%22r%22%20id%3D%228326%22%2

//This part works fine if I am passing a string:


//
myService.cancel();
var params:XML = new XML();
var n:Number = 0;
for (var players:String in xfrObj){
params["param"+n] = xfrObj["player"+n].toString();
trace(params["param"+n]);
n=n+1;  
}

myService.send(params);







[flexcoders] Try again...Error with HTTPService POST making malformed element

2007-10-25 Thread i.yoho
Sorry if this posts twice. I just had an "all thumbs moment" trying to
explain this error...

I am new to Flex and need help with getting the appropriate containers
set up to send GOOD data from a swf to PHP to do the write to an XML file.

// The beginning of the error is...
[RPC Fault faultString="Error #1090: XML parser failure: element is
malformed." 

// The beginning of the string that gets passed according to the
Apache access log is...
?param2=%3Cplayer%20type%3D%22r%22%20id%3D%228326%22%2

//This part works fine if I am passing a string like "Hello world"...


// I suspect that I am not setting up the associative array properly
here. But I don't understand enough to fix it...

var params:XML = new XML();
var n:Number = 0;
for (var players:String in xfrObj){
params["param"+n] = xfrObj["player"+n].toString();
n=n+1;  
}
myService.send(params);

Thanks,
Imogene