PDA

View Full Version : What is Flash Remoting?


Selfminded
07-22-2006, 12:21 PM
I've been reading the docs at Adobe and I can't figure out what Flash Remoting would do to better my Flash applications. In fact, I can't tell what it is really.

I usually store everything in MySQL and use PHP scripts with LoadVars() objects to get data in and out of Flash. This works fine for my RIAs.

How can Flash Remoting change this for the better and what am I not seeing about this technology? Please help, thanks.

Oh and don't be afraid to go into detail, I really want to understand this. Give examples, give benchmarks, give anything. Thanks again.

Selfminded

mooska
07-26-2006, 02:44 PM
http://www.actionscript.org/tutorials/intermediate/PHP_Remoting/index.shtml

meddlingwithfir
08-02-2006, 06:43 PM
It essentially removes having to pass data through an extra step (HTML) and lets Flash directly access data you have in a database. So rather than depending on the HTML page to update your flash data (you'll have to refresh the page, or work some tricky Javascript), you can just have Flash go out and query the database again directly.

Another bonus for me is that when my ColdFusion <cfquery> call returns a Query object, Flash understands that and can can process that data easily (and without giving me headaches :)).

Here's a template that I use whenever I set up my Remoting .fla's:

// Set up the gateway to the Flash Remoting component
NetServices.setDefaultGatewayUrl("http://[site domain]/flashservices/gateway");
var gatewayConnection = NetServices.createGatewayConnection();
// direct the server to the ColdFusion component file it's using
var server = gatewayConnection.getService("[ColdFusion component path]", this);
// the server calls a function inside the component file
server.[ColdFusion Function name here]( [arguments] );

[ColdFusion Function name here]_Result = function(rs) {
// get the number of results.
max = rs.getLength();
trace('returned ' + max + 'results');
}



I'm not sure it's the fastest way to transmit data from the database to the flash app, but it works fast enough to satisfy my clients...