90 likes | 215 Views
Andrew Giles. FLASH and RPC using AMFphp. What are we talking about here?. A simple integration of actionscript and php. Also integrates Flex, Javascript, Ajax, XML. The in's and out's Uses and Ideas Resources A real-time example. RPC?. Remote Procedure Call
E N D
Andrew Giles FLASH and RPC using AMFphp
What are we talking about here? • A simple integration of actionscript and php. • Also integrates Flex, Javascript, Ajax, XML. • The in's and out's • Uses and Ideas • Resources • A real-time example
RPC? • Remote Procedure Call • Communication between client and server by setting a callback and receiving a result. • How AMFphp does it... • Perform request • Deserialize request • Finds the corresponding remote class • Instantiates the class • Performs security checks • Calls the remote method using the specified arguments • Serializes the returned data
Getting Started actionscript... • Include the required classes import mx.remoting.debug.NetDebug; import mx.remoting.*; import mx.rpc.*; NetDebug.initialize(); • Create the servicevar service:Service = new Service('http://localhost/amfphp/gateway.php', null, 'com.company.MyService'); • Create the remote methodvar pc:PendingCall = service.myMethod("arg1", {x:'myX'}); pc.responder:RelayResponder = new RelayResponder(this, "onSuccess", "onFault"); • Handle the resultfunction onSuccess(re:ResultEvent){ trace("Success!"); } function onFault(){ trace("Fudge! :("); }
Getting Started php... <?php class HelloWorld { function HelloWorld() { $this->methodTable = array ( "say" => array ( "access" => "remote", "description" => "Pings back a message" ) ); } function say($sMessage) { return 'You said: ' . $sMessage; } } ?>
Example Uses and Ideas • Data Visualization • Online/Intranet CRM • Content Management Systems • RFID/Database Integration • Web Services • RSS • Dynamic Gaming Environments • Real Estate and MLS websites • Website file system automation
Advantages? • Object Oriented • Real-time feedback • Consistent layouts and interactivity • Cross browser/platform compatibility • Stand-alone projector applications
Resources • http://www.amfphp.org/ • http://www.sephiroth.it/ • http://www.flash-db.com/ • http://www.macromedia.com/devnet/mx/flashremoting/