PDA

View Full Version : AMFPHP+Imported Class, how can i do that?


weilies
11-13-2007, 06:19 AM
Hi, can someone tell me how should i get return result from a wrapper class for AMFPHP?

ActionScript

import mx.remoting.*;
import mx.rpc.*;
import mx.remoting.debug.NetDebug;
import com.myWrapper.Agent;

cm = new com.casualmaster.Agent;
cm.getDeveloperFolder();
...

in my library file
class com.myWrapper.Agent extends Object {
...

// get developer folder
public function getDeveloperFolder() {
var gatewayUrl:String = "http://localhost/cm/plugins/sfAmfphpPlugin/lib/vendor/amfphp/gateway.php"


NetDebug.initialize();
var _service:Service = new Service(this.GATEWAY_URL, null, this.SERVICE_NAME, null , null);
//trace(this.API_ID);

var pc:PendingCall = _service.getDeveloperFolder(this.API_ID, this.API_KEY, this.DEV_ID);
pc.responder = new RelayResponder(this, "onGetDeveloperFolderSuccess", "onGetDeveloperFolderFail");
}


// event handler
private function onGetDeveloperFolderSuccess(re:ResultEvent) {
if (re.result) {
trace(re.result);
} else {
trace('Fail to get developer\'s folder. Please ensure API_ID, API_KEY, DEV_ID are correctly entered');
}
}


private function onGetDeveloperFolderFail(fe:FaultEvent) {
trace('Error: Unable to connect to service');
}

i can trace out the result return from my php code. But when i want something like

my_return_value = cm.getDeveloperFolder();

How should i tell my class to do that? How to return result from
"private function onGetDeveloperFolderSuccess(re:ResultEvent)"?

Thank.