I'm building a mvc application which will communicate with flash via AMF, anybody knows if there is any AMF ActionResult available on the web ?
EDIT:
using @mizi_sk answer (but without using IExternalizable) I did this ActionResult:
public class AmfResult : ActionResult
{
private readonly object _o;
public AmfResult(object o)
{
_o = o;
}
public override void ExecuteResult(ControllerContext context)
{
context.HttpContext.Response.ContentType = "application/x-amf";
using (var ms = new MemoryStream())
{
// write object
var writer = new AMFWriter(ms);
writer.WriteData(FluorineFx.ObjectEncoding.AMF3, _o);
context.HttpContext.Response.BinaryWrite(ms.ToArray());
}
}
}
but the response handler on the flash side doesn't get hit.
in Charles at the Response->Amf tab I see this error:
Failed to parse data (com.xk72.amf.AMFException: Unsupported AMF3 packet type 17 at 1)
this is the raw tab:
HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Mon, 14 May 2012 15:22:58 GMT
X-AspNet-Version: 4.0.30319
X-AspNetMvc-Version: 3.0
Cache-Control: private
Content-Type:application/x-amf
Content-Length: 52
Connection: Close
3/bingo.model.TestRequest param1coins name
and the Hex tab:
00000000 11 0a 33 2f 62 69 6e 67 6f 2e 6d 6f 64 65 6c 2e 3/bingo.model.
00000010 54 65 73 74 52 65 71 75 65 73 74 0d 70 61 72 61 TestRequest para
00000020 6d 31 0b 63 6f 69 6e 73 09 6e 61 6d 65 01 04 00 m1 coins name
00000030 06 05 6a 6f jo