Legal
The views expressed in this blog are my own and do not necessarily reflect the views of Adobe Systems Incorporated.
Search
May 15, 2006
Passing Parameters from Flex to AMFPHP
I had an email the other day from a developer who was wondering how to pass PHP parameters via ActionScript. The answer is very simple... Let's take a look at some sample code from my PHP Gallery / Flex project:
public function getPhotosForAlbum( AlbumID:int ) : void
{
gateway = new RemotingConnection( "http://localhost/amfphp/gateway.php" );
gateway.call( "embededGallery.getPhotos", new Responder(onResultGetPhotosForAlbum, onFault), AlbumID);
}
You can see in this ActionScript code that the AlbumID is being passed to the "getPhotos" AMFPHP call. So easy, just add the parameters to the end of the RemotingConnection call, as a 3rd parameter.
Hope that helps some of you out!
Comments
I am having problems running my AMFPHP program with FLEX2 Beta 3. It works when I run the server on one machine and the swf on the other. But if I run both on the local host I get an Error#2028 Local Untrusted File. I am using the mxmlc on my MAC and the compilation is fine. It only produces a SWF file, no html.
How do I listen for errors other than a fault, ex network error ?
I added listeners ioError and netStatus to NetConnection and nothing happens.
thanks in advance.
Thank you for signing in, You may now comment. (Sign Out)
(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)