从Flash或纯AS3项目使用RemoteObject(AMF) [英] Using RemoteObject (AMF) from a Flash or Pure AS3 Project

查看:175
本文介绍了从Flash或纯AS3项目使用RemoteObject(AMF)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近移植从Flex项目的一些code到一个新的纯AS3项目。当我试图使一个AMF电话,我收到一条错误信息是这样的:

I recently ported some code from a Flex project over to a new pure AS3 project. When i attempted to make an AMF call, I am getting an error message like this:

类型错误:错误#1034:类型强制失败:无法转换对象@ 5425371至mx.messaging.messages.ErrorMessage

TypeError: Error #1034: Type Coercion failed: cannot convert Object@5425371 to mx.messaging.messages.ErrorMessage.

有与该错误相关的堆栈跟踪,所以调试是困难的。

There was no stack trace associated with the error, so debugging was difficult.

我试过的东西(检查从Flex框架所需的所有库都包括在内,等等),所有的方式,但毫无效果。

I tried all manner of things (checking that all required libraries from the flex framework were included, etc) but nothing worked.

推荐答案

:弹性确实在启动该AMF类将不无功能进行一些初始化。幸运的是,Adobe公司认为,谁想要使用AMF从非Flex项目,或者从闪存,并提供了一​​个方法,通过做AMF所需的初始化。

After some time i found the answer: Flex does some initialization on startup which the AMF classes will not function without. Luckily Adobe has thought of those who want to use AMF from a non-flex project, or from flash, and have provided a method for doing the initialization required by AMF.

我添加了此行我的应用程序的启动,突然所有的AMF调用的工作,以及他们在我的Flex项目所做的:

I added this line to the start of my application, and suddenly all AMF calls worked as well as they did in my Flex project:

RpcClassAlias​​Initializer.registerClassAlias​​es();

RpcClassAliasInitializer.registerClassAliases();

(是啊,我回答了我的问题,我没有发现任何博客或搜索结果对于这个问题,所以我共享的问题,并解决在这里。)

(Yeah, i answered my own question. I didn't find any blogs or search results for this problem, so i'm sharing the problem and fix here.)

这篇关于从Flash或纯AS3项目使用RemoteObject(AMF)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆