PDA

View Full Version : help!error in result handlers


vsiany
04-29-2005, 11:54 AM
Hi everybody,

I'm just started studying on amfphp. I had followed a tutorial, but the output is not as axpected. Somehow the result handlers is not being executed. :(

Here is the link for installing amfphp remoting tutorial
http://www.actionscript.org/tutorials/intermediate/PHP_Remoting/index.shtml

I'd done some researched and I found that I had correctly installed the amfphp and the php file. The other possibly problem would be on the script. But I couldn't find out what's wrong with the script.

here is the flash file code:
// Include files necessary for Remoting debugging and coding
#include "NetDebug.as"
#include "NetServices.as"
// Establish connection to PHP Remoting
NetServices.setDefaultGatewayURL("http://localhost/test_remoting/simple_gateway.php");
conn = NetServices.createGatewayConnection();
// Retrieve service
talkback = conn.getService("talkback", this);


// Define result handling code ---->this one seems not being executed
function returnString_Result(result) {
trace("Got result \""+result+"\" of type "+typeof (result));
}
function returnNumber_Result(result) {
trace("Got result \""+result+"\" of type "+typeof (result));
}
function returnArray_Result(result) {
trace("Got result \""+result+"\" of type "+typeof (result)+" which contained the following:");
for (item in result) {
trace(" "+item+": "+result[item]);
}
}
// Call some functions
trace("Calling returnString");
talkback.returnString("Flash Remoting is groovy");
trace("Calling returnNumber");
talkback.returnNumber(50);
trace("Calling returnArray");
test = new Object();
test.foo = "bar";
talkback.returnArray(test);


I'd used the NetConnection debugger already and it showed that the connection and 3 called handler but no result has been returned.
ConnectString: "http://localhost/test_remoting/simple_gateway.php"
MethodName: "talkback.returnString"
Parameters (object #2)
.....[0]: "Flash Remoting is groovy"
MethodName: "talkback.returnNumber"
Parameters (object #2)
.....[0]: 50
MethodName: "talkback.returnArray"
Parameters (object #2)
.....[0] (object #3)
..........foo: "bar"


any help would be appreciated

kind,

vsiany