Monthly Archive for April, 2007

Release 0.1g

SWX Alpha 0.1g is now available for download.

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.




Bad Behavior has blocked 3746 access attempts in the last 7 days.