ActionScript 3 AMF Zend 静默失败 [英] ActionScript 3 AMF Zend fails silently

查看:28
本文介绍了ActionScript 3 AMF Zend 静默失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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).

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

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

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

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.

这就是我用 ActionScript 写的:-

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");
   }

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

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.

有什么建议吗?

推荐答案

我花了很长时间才意识到 - 但网关 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.

这篇关于ActionScript 3 AMF Zend 静默失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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