如何将类型化对象从 FMS 发送到客户端
我在FMS中有以下对象
User = function(userName,userId)
{
this.userName = userName;
this.userId = 用户Id;
我
需要将用户列表发送到客户端 swf。一旦我将 User 对象集合初始化为数组,当我从客户端读取数组元素时,数组元素是未定义的。
但是我也无法发送通用对象。一旦我初始化了对象中的数组元素,如下所示。它还在客户端给出了未定义的信息。
var myObj = {userName:"user1name", userId:"user1id"};
但以下工作
var arr2 = [];
arr2["用户名"] = "用户名1"; arr2["用户ID"] = "用户1ID";
客户端连接到 FMS 上的主应用程序。然后它通过 NetConnection 连接到第二个应用程序。我已经使用“registerProxy”功能映射了远程方法。
例如:application.registerProxy(localName,this._nc,remoteName);
以上描述了第二应用中的方法。我在客户端使用 Actionscript 2。
任何解决该问题的方案都受到高度赞赏。
提前致谢。
I have following object in the FMS
User = function(userName,userId)
{
this.userName = userName;
this.userId = userId;
}
I need to send the list of user to the client swf. Once I initialized the User object collection to an array, array element is undefined when I read it from the client.
However I can’t send the generic object too. Once I initialized the array elements in Objects as follow. It also give the undefined in the client side.
var myObj = {userName:"user1name", userId:"user1id"};
But following works
var arr2 = [];
arr2["userName"] = "user1name ";
arr2["userId "] = " user1id";
Clients are connected to the main application on the FMS. Then it connect to second application through NetConnection. And I have mapped the remote method using the ‘registerProxy’ feature.
Eg: application.registerProxy(localName,this._nc,remoteName);
Above described method in the second application. I’m using Actionscript 2 for client side.
Any solution for the matter is highly appreciated.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,没有办法将客户端类映射到服务器端FMS类。据我所知,在 AS2 中,这个功能根本不存在。
我已经用 AS3 尝试过你的例子。传递对象(尽管无类型)适用于 FMS 3.5。
客户端:
服务器端:
AS2 和 AS3 之间差异的原因可能在于所使用的对象编码协议 - AMF0 与 AMF3。尽管如此,AMF0 在 AS3 中按预期工作。
因此,也许可以考虑将您的应用程序移植到 AS3。
As far as I know, there is no way to map client-side classes to server-side FMS classes. In AS2 this functionality was simply absent, as far as I remember the old times.
I've tried your example with AS3. Passing objects (though untyped) works with FMS 3.5.
Client-side:
Server-side:
The reason in differences between AS2 and AS3 might be in object encoding protocol being used - AMF0 vs AMF3. Although, AMF0 works as expected in AS3.
So, perhaps, consider porting your application to AS3.
谢谢,但是您给了我很好的提示:) FMS 服务器上的内部应用程序 NetConnection 出现问题。默认情况下,FMS 3 使用 AMF3 序列化。自从我的客户端应用程序 AS2 以来,我更改了 FMS 上的 ObjectEncoding Application.xml,
例如。AMF0
Thanks, However you gave me good hint :) Problem in the inter application NetConnection on the FMS Server. By default FMS 3 uses the AMF3 serialization. Since my client application AS2, I have change the the ObjectEncoding Application.xml on FMS
eg.
<ObjectEncoding>AMF0</ObjectEncoding>