I am building an application using Flex 4.5 and Zend_AMF as my AMF endpoint.
I would like to map a class called CRequest in PHP to a class called Request in Flex.
This is my php class:
<?php
namespace app\web;
class CRequest{
public $_explicitType = 'com.site.remote.Request';
public $stuff1;
public $stuff2;
}
This is the actionscript class: com.site.remote.Request
package com.dreamatique.remoting
{
[Bindable]
[RemoteClass(alias="com.site.remote.Request")]
public class Request
{
public var stuff1:String;
public var stuff2:String;
public function Request()
{
}
}
}
As a test, I have made the endpoint return an instance of CRequest
from the PHP side, no matter what the request.
I am then making a remote object call like this:
var remoteObject:RemoteObject = new RemoteObject();
remoteObject.endpoint = "http://localhost/to/my/amf/endpoint";
remoteObject.showBusyCursor = true;
remoteObject.source = 'testing';
var op:AbstractOperation = remoteObject.getOperation(null);
op.addEventListener(ResultEvent.RESULT, result);
op.send();
public static function result(event:ResultEvent):void{
trace(event.result);
trace(Class(getDefinitionByName(getQualifiedClassName(event.result))));
Alert.show(event.result.toString());
}
The problem is that the result comes back typed as ObjectProxy
and not Request
. What am I doing wrong?