Menu:

Sponsor

Discover Master of Alchemy, our first iPad/iPhone and iPod touch game!

Follow Me

 

Forum's topics

Latest Files

Archives

Top Rated

Categories

Photo Gallery


AMFPHP 0.9b Installation Guide

Analizing the code just inserted:

mainResponder = new Object();

In Flash remoting (the Flash side) there are 2 ways to declare functions which will invoked once a server method respond to Flash.
The first one is just declaring a function with the same name of the function called plus a "_Result" string.
E.g.:

function echoString_Result( data ) { }
serv = conn.getService("EchoTest", this)

In this way the serv object tells to flash that the responder object is "this", so flash will check in this object (in this case the _root) for the correct responder functions to be called. You will need to declare all the responder functions in the root in this way.

The second way is to create a responder object ( mainResponder = new Object() ), and then create inside this object all the responder functions, like in our example.
In fact I specified that the responder is mainResponder:

serv = conn.getService("EchoTest", mainResponder );

The "data" argument defined inside all the responder functions is the object received from the server. So, the data argument inside the echoString_Result, will be the ucwords string passed from php back to flash.

Moreover, beside the _Result function, you can define a _Status function. This particular function is invoked when server respond with an error.
For example, if you call serv.echoString() without any argument, the php function will reply with an error.

the syntax is:

mainResponder.echoString_Status = function ( data ){}

but you can also define a generic _Stauts function (without defining one for every remote method ). The generic function will be:

mainResponder.onStatus = function ( data ){}

in this way, every time server reply with an error, this particular function will be invoked. The data argument contains informations about the server error such as (line, level, details, description, code)

Finally, once all the responder function have been defined, you can call every remote method (the functions defined in the php Class), simply in this way:

serv.echoString("hello world");   // service.method( argument )

2.5 the NetConnection Debugger

Now, test you flash movie with the NetConnection Debugger opened

As you can see the Debugger will show you all the useful informations about the calls and results from the server.

3. NetConnection.Bad.Call

A very common issue is to get a "NetConnection.Call.BadVersion" answer in your NetConnection debugger. There are various causes for this failure; the general reason is that the client doesn't receive a correctly formatted AMF message.

This is generally due to installation errors, parse errors in your code, or any number of other reasons

The most common are listed below.

  • The AMFPHP installation was not correctly performed; the gateway cannot find the libraries. You can check this by pointing your browser at your gateway URL, for instance: http://host/flashservices/gateway.php. If any PHP errors appear, the gateway is not correctly installed. Perform the AMFPHP installation correctly.
  • Your service has parse errors. Point your browser at the URL of your services, for instance: http://host/flashservices/services/examples/ExSrv.php to see what parse errors are prevalent in your code.
  • Your script is pushing data into the output buffer. Check that your script has no leading OR trailing newlines or spaces and that your script isn't outputting any data with an echo, print, or other similar control structure or function as this will result in sending this data to the client, before the actual AMF message is sent.
  • If you work under Windows or Mac OS X, your editor may be creating incompatible line breaks. Windows terminates every line with CRLF (\n\r); some applications in Mac OS X terminate lines with the standard Mac line ending (chr(13)) plus a CR (\n). We suggest the following editors for Windows users: