私はAMFを介してフラッシュと通信するMVCアプリケーションを構築していますが、Web上で利用可能なAMF ActionResultがあるかどうかは誰にもわかりませんか?
編集:
@mizi_sk回答を使用して(ただし、IExternalizableを使用せずに)この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());
}
}
}
ただし、フラッシュ側の応答ハンドラーはヒットしません。
Charlesの[応答]->[Amf]タブで、次のエラーが表示されます。
データの解析に失敗しました(com.xk72.amf.AMFException:サポートされていないAMF3パケットタイプ17 at 1)
これは生のタブです:
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
および[16進]タブ:
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