There are major API changes in this release. Please make sure that you read the release notes below.
What's new in Alpha 0.1g:
- API Change. The className property is now "serviceClass".
- API Change. The data property is now "arguments".
- How service methods are called has changed. See detailed description and code sample, below.
- Deployment: Removed some .svn folders that were somehow checked in.
- SVN: Added tags to repository.
- Deployment: Renamed text folder to "docs" to make it clearer.
- Docs: Updated docs to reflect API changes in 0.1g
Starting with 0.1g, you are no longer limited to sending a single argument to your server-side service class method. Previously, you would set the data property on your data holder movie clip and this would be sent as the first (and only) argument to your server-side method. This meant that existing service classes (for example, ones you had already written for Amfphp or classes in third-party public APIs) would have to be re-written. Of course, we don't want that. We want to be able to use existing service classes without changing them and that means that we need to be able to pass any number of arguments. Starting with 0.1g, you can.
The data property has now been replaced with the arguments property to reflect this change.
Set the arguments property on your data holder movie clip to the array of arguments that you want to pass to your server-side method.
For example, if the method signature for your service method is getDirectMessages($user, $pass), your arguments array would look something like:
dataHolder.arguments = ['aral', 'mypass'];
In this example, SWX will call getDirectMessages('aral', 'mypass') on the server.
Here is how the echoData sample looks now.
Flash:
import org.swxformat.*; var myData:Array = ['data', 'to', 'send']; dataHolder.serviceClass = "Simple"; dataHolder.method = "echoData"; dataHolder.arguments = [myData]; Prepare.forPhp(dataHolder); dataHolder.loadMovie("http://a.com/path/to/swx.php", "POST");
PHP:
class Simple { public function echoData($data) { return $data; } }
The introductory SWX post has an extended version of the above example, including comments.

I’m getting ‘data = ["Error: No class name supplied."];’ (via ASV and SWX Analyzer) when running the Flash example. The ActionScript in the example .fla file does indeed specify the class (Simple) and method (echoData), and the php class is available in the ‘/services’ directory.
I’m using a clean install of 0.1g - any ideas what might be going on?
Yep, you should change:
dataHolder.serviceClass
with
dataHolder.className
When you make the call, the docs in the zip are wrong. I’m trying to find out why my php class doesn’t receive parameters, but couldn’t find it yet.
Cheers,
Juan
Changing dataHolder.serviceClass to dataHolder.className fixed that - now onto the parameter issue.
Thanks!
Hi Bryan, Zarate,
Apologies for the hassle. 0.1g had incorrect versions of the SWX gateway and the SwfCompiler class. I’ve made a new release that should work (and I’m going to implement automatic builds as a priority so this sort of thing doesn’t happen in the future.)
This latest release should work as per the docs with the new API (serviceClass instead of className and arguments instead of data).
PS. Apologies for not getting to this sooner, I’ve been offline most of today (resting the ‘ol hands after three weeks of constant typing.)
Aral,
Thanks for posting this fix, and please don’t apologize for not getting to it sooner - there are so many more important things in life.
thanks for the prompt fix
the difference between your software and amfphp
is that yous works in internet explorer 7 in xp
amf doesn’t
I am now revieving the following error
“Value = Error: Passed PHON object is not valid.”
It works fine when i use the array myData
instead of someComplexData