Payday Loans Online Payday Loans Online

Todd Rothe : UI/UX Developer

it's pronounced rowth-ee

By 2g1c2 girls 1 cup

AMFPHP Quick Start

AMFPHP is handy when creating a Flex app which interfaces with a php backend.
“AMFPHP allows thin client applications built in languages such as Flash, Flex, and AIR to communicate directly with PHP class objects on the server.” http://amfphp.sourceforge.net/
And here is a short guide to getting AMFPHP working with Flex without the Zend Framework.

1. Download and extract the latest AMFPHP.

2. Copy core dir, gateway.php, globals.php, and services dir from the extracted contents and paste them into your php app root. This guide assumes that you are running your php from a server such as Mamp/Xamp.

2.A. Visit gateway.php in your browser to ensure that everything is in place.

http://localhost:8888/MyFlexApp/gateway.php

3. Place your php class in the services dir that you pasted into your php app root. Here is my php class. ReturnString.php. Ensure that your php class contains only standard characters (bad = ReturnString.class.php). * If your project has php services defined and they are in a dir other than the ‘services’ dir, then modify the $servicePath var in the globals.php file.

4. In your actionscript you will need to create a remote object, populate some of its props and then add some listeners and call your php method.

protected var ro:RemoteObject = new RemoteObject();

init():void
{
ro.endpoint = ‘http://localhost:8888/MyFlexApp/gateway.php’;
ro.destination = ‘ReturnString’;
ro.source = ‘ReturnString’;

ro.addEventListener(ResultEvent.RESULT, returnStringHandler);
ro.addEventListener(FaultEvent.FAULT, returnStringFaultHandler);
ro.getString();
}

protected function returnStringHandler( event:ResultEvent ):void
{
trace(“returnStringHandler result : “+ event.result);
}

protected function returnStringFaultHandler( event:FaultEvent ):void
{
trace(“returnStringFaultHandler result : “+ event.result);
}

No real insights or brand new information contained in this post. Just a straight forward guide to implementing AMFPHP.

 

No Responses to “AMFPHP Quick Start” (post new)

 

Leave a Reply

You must be logged in to post a comment.