0

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?

Dennis Jaamann
  • 3,547
  • 2
  • 23
  • 42
user433579
  • 1,223
  • 1
  • 10
  • 17

2 Answers2

0

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

Eugeny89
  • 3,797
  • 7
  • 51
  • 98
  • It's not that. Got an "allow everything" crossdomain.xml, and put another in the service subdirectory - just in case. The .swf that I'm testing is the bin-debug version in the project (file://) - tested in the browser. – user433579 Jun 01 '11 at 18:46
  • @user433579,there's nothing strange in code. I think it's something about configuring, the most common trouble here is `crossdomain.xml`. Are you sure you configured ZEND properly? – Eugeny89 Jun 01 '11 at 19:35
  • When I went through the Flex 4.5 tutorial - it installed Zend on my local webserver. And I was able to access the service using the Flex app described in the tutorial. Just odd that it fails silently (no completion callback) in pure actionscript. – user433579 Jun 01 '11 at 21:27
0

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.

user433579
  • 1,223
  • 1
  • 10
  • 17