Cold Fusion Flash Remoting
Flash Remoting
- Accessing live or real-time data.
- Exposing of the power of your server hardware and application servers such as ColdFusion MX through the Macromedia Flash player.
- Consuming internal or external web services
http://www.macromedia.com/devnet/coldfusion/articles/remoting.html
Using Flash Remoting, data transformations are no longer required. You can now send structured variables (including query recordsets or arrays) from your server to the Macromedia Flash player easily and securely. This saves computing time on both the server and the client, not to mention development time.
Flash Remoting is the best way for Macromedia Flash applications to exchange data between a client and server.
Flash Remoting makes remote accessibility possible because the Flash Remoting service acts as a proxy on the server.
Understanding Macromedia Flash Remoting
In ColdFusion, Macromedia Flash Remoting is the way information is exposed to Macromedia Flash as a remote service. The Flash Remoting service does not need to be configured, and is automatically installed with ColdFusion MX. Flash Remoting uses a gateway through a standard HTTP request, as follows:
http://127.0.0.1/flashservices/gateway
http://[servername]/flashservices/gateway
The "flashservices/gateway" path reference is not an actual folder on the web server. It is a logical mapping for the Flash Remoting service in ColdFusion MX. Once the flashservices/gateway is mapped, your services are referenced in their actual folders beneath the wwwroot folder.
For example, for Flash Remoting to access a ColdFusion component called parkService.cfc on the server that is located at /webroot/devCenter/, the Flash Remoting service refers to it as:
Absolute path: \wwwroot\devCenter\parkService.cfc
Gateway reference: http://127.0.0.1:8500/flashservices/gateway/devcenter.parkService
Building the ColdFusion Component (CFC) for Flash Remoting
cffunction tag requires the following attributes:
Name: This is the method name for the function (or method). Flash refers to the name when it calls the method.
Access: This attribute makes the function accessible to remote resources
ReturnType: This attribute informs the Macromedia Flash Player that the results will be a recordset.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ActionScript
createGatewayConnection:
Connects to the Macromedia Flash Remoting (server) and sets the object function "Connection".
getService([sevicefolder.servicename],[object]:
Generates a Macromedia Flash service object that gives you access to the functions inside the service (or CFC)
What happens in the ActionScript after calling the CFC functions?
When you run a service-function, you may want Macromedia Flash to perform some action with the data. The Macromedia Flash player will automatically call a "Service Default Responder." This responder function will run when the service-function (from your CFC) is complete and has been returned to the Macromedia Flash player.
Each service function that returns data back to Macromedia Flash must have a responder setup to handle the returned data. The NAME of the function (or method) will be the same as you named the method in your CFC (this is the name attribute that you assigned to your cffunction tag.)
The syntax for the default responder is as follows:
[service function]_result (returnData) {actions to run}
The service function defined in the CFC is called "getParkTypes." Macromedia Flash will call the service default responder "getParkTypes_result" when the service function has finished and delivered the data. This function (getParkTypes_result) takes one parameter. The parameter will contain the query object returned from the server. Use the parameter "result" to access the query data

0 Comments:
Post a Comment
<< Home