Table of contents:

HelloWorld

It's time to connect to your first service! To get started download the amfphp-examples and extract them to your workspace. Open the folder called HelloWorld-> services where you will find the HelloWorld.php file. Upload this service to the amfphp/services folder that was created durring installation. The HelloWorld class has only one method called "say" that takes a string as an argument. It returns a string with "You Said: " catinated with the data sent to the service.

Flash CS3

Open Flash CS3 and open the two files located in HelloWorld -> Flash CS3 folder.

HelloWorld.fla : Is the user interface elements.
Main.as: is the Document Class that HelloWorld.fla uses for its logic.

Edit the Main.as file and update the variable gateway to match your installation directory. The example file has the following value:

public function Main() {
   private var gateway:String = "http://localhost/amfphp/gateway.php";

Publish the HelloWorld.fla and update the text that is being sent to the server. Press the "Send to Server" button.

Hello World

Flex 2

Example coming soon.

Success

You now have Flash or Flex connecting to AMFPHP. It's time to read through the fundamentals, play with some tutorials, and start creating your own services.


© amfphp.org | Disclaimer | Conditions of use