Tom Lauck’s

Flex AMFPHP Variables


Working with XML in AS2 is to say the least, one of the dumbest and most redundant things in the world to me. Because of this, I use Flash Remoting. It just makes more sense. So when I moved on to Flex, even though XML is native in AS3, I still went with remoting. Mike Potter from Adobe had a basic tutorial on getting started with Remoting in Flex…for it is a little differnent from Flash. And those differences can really throw you, and leave yourself cursing at your own stupidity.

Here was my issue: Everything was going fine with my development, and I was falling even more in love with Flex and then all of a sudden, variables were not getting passed when I started debugging. Huh? So to make a long story short, the syntax for passing variables in Flex is a little different from the the standard/basic AMFPHP structure:

Rather than something like this:

public function getAllPages(){
	gateway = new RemotingConnection("http://localhost/flashservices/gateway.php"); "SitePages.getAllPages(php_variable)", new Responder(handleGetAllPages, onFault));

Notice the placement of the variable “php_variable” above.

You do something like this:

public function getAllPages(){
	gateway = new RemotingConnection("http://localhost/flashservices/gateway.php");"SitePages.getAllPages", new Responder(handleGetAllPages, onFault), php_variable);

2 Responses

date: November 8th, 2006

Good tip. The PHP RIA SDK by Adobe has examples that may help you out: and then click on the download link.


spoken by: Mike Potter

date: November 15th, 2006

Thanks for the info! The SDK has a lot of potential and will prove to be very usefull. It seems like you have a nice community started.

spoken by: tom

Leave a Reply

Oct 31 2006