开发者

ActionScript 3 AMF Zend fails silently

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 th开发者_如何学编程at 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?


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜