AMFPHP and multiple PHP functions

By NRaf | Jul 3, 2009

actionscript3

Hey,

I’m creating a Flash site and need access to MySQL content. I’m using AMFPHP and have been fine until now.

What I need is a way to get a responder (flash.net.Responder) depending on the PHP function (or more accurately method) I’m calling.

The code is as follows:

ActionScript Code:
public function getMainCollections():void         {             connection.call(“#####.getMainCollections”, responder);         }                 public function getSubCollections(subID:int):void         {             connection.call(“#####.getSubCollections”, responder, subID);         }                 //Handle the result of the SQL function         override protected function onResult(result:Object):void         {             this.result = result;                                     dispatchEvent(new ServerEvent(ServerEvent.RESULT_RECEIVED));         }

As you can tell, the responder object calls the onResult method after receiving a result from the server. This dispatches a new event (from my custom event class ServerEvent).

This event will be called regarding of which PHP method was called #####.getMainCollections() or #####.getSubCollections(). Therefore any code that listens for the ServerEvent.RESULT_RECEIVED event won’t be able to differentiate which PHP method was called and will act the same way in either instance.

To cut a long story short, is there any way to act differently depending on which PHP method was called using the same responder object?

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0