ActionScript 3 AMF Zend 无提示失败

发布于 2024-11-10 17:47:48 字数 1250 浏览 8 评论 0原文

我正在尝试在纯 ActionScript 程序中连接到 Zend-PHP 服务。我已经成功地使用 Flex 来使用该服务。 (但是 Flex 移动应用程序很臃肿,通常比纯 ActionScript 应用程序大 10 倍 - 这就是我尝试用纯 Actionscript 编写它的原因)。

我正在尝试访问我下载并在以下教程中使用的 PHP/Zend 服务:-

http://www.adobe.com/devnet/flex/testdrivemobile/articles/mtd_1_1.html

我要连接的 PHP 代码可从此网站下载- 以及有关如何在 Flex 中使用它的说明。

这就是我在 ActionScript 中编写的内容:-

   protected var _netConnection:NetConnection;

   protected var _responder:Responder;
   //...

   _netConnection = new NetConnection();
   _responder = new Responder(complete, errorFn);
   _netConnection.addEventListener(NetStatusEvent.NET_STATUS, errorFn);
   _netConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorFn);
   _netConnection.connect("http://localhost/TestDrive/services/EmployeeService.php");
   _netConnection.call("EmployeeService.getEmployeesSummary", _responder);

   public function complete(result:Object):void {
      trace("complete");
   }

当我运行它时,它会默默地失败。没有回调。如果我更改 connect 或 call 方法的参数,则 errorFn 回调起作用 - (我已经尝试了很多事情) - 我可以获得 NetConnection.Call.BadVersion 或 NetConnection.Call.Failed。但我从未设法回调完整的方法。

有什么建议吗?

I'm trying to connect to a Zend-PHP service within a pure ActionScript program. I've managed to use the service successfully using Flex. (But Flex mobile apps are bloated, and typically 10x bigger than pure ActionScript apps - which is why I'm trying to write it in Pure Actionscript).

I'm trying to access the PHP/Zend service that I downloaded, and used in the following tutorial:-

http://www.adobe.com/devnet/flex/testdrivemobile/articles/mtd_1_1.html

The PHP code that I'm connecting to is available as a download from this site - as well as instructions about how to use it in Flex.

And this is what I've written in ActionScript:-

   protected var _netConnection:NetConnection;

   protected var _responder:Responder;
   //...

   _netConnection = new NetConnection();
   _responder = new Responder(complete, errorFn);
   _netConnection.addEventListener(NetStatusEvent.NET_STATUS, errorFn);
   _netConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorFn);
   _netConnection.connect("http://localhost/TestDrive/services/EmployeeService.php");
   _netConnection.call("EmployeeService.getEmployeesSummary", _responder);

   public function complete(result:Object):void {
      trace("complete");
   }

When I run this, it fails silently. No callbacks. If I change the parameters of the connect or call method, the errorFn callbacks work - (I've tried lots things) - I can get NetConnection.Call.BadVersion, or NetConnection.Call.Failed. But I've never managed to get the complete method called back.

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

说不完的你爱 2024-11-17 17:47:48

也许是crossdomain.xml?你确定把它放在服务器上吗?

maybe it's crossdomain.xml? Are you sure you put it on server?

甜心小果奶 2024-11-17 17:47:48

我花了很长时间才意识到 - 但网关 URL 指向了错误的 .php 文件。 (但是如果代码没有默默地失败并产生一些诊断,我可能会更快到达那里)。无论如何 - 感谢大家的帮助。

It took me a long time to realise - but the gateway url was pointing to the wrong .php file. (But had the code not failed silently, and yielded some diagnostics, I might have got there quicker). Anyway - Thanks for your help everyone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文