Flash remoting is the most efficient among the four data interfaces!
Advantages :
1. Supports multiple data types (converting from application server data types to ActionScript );
2. The transferred data volume is large;
3. The operational efficiency is the highest among the several existing ones;
4. good support for various background services;
5. netconnection Debugger)
disadvantages :
1. flash remoting MX components needs to be installed on the flash end (this is provided for free);
2. the Flash remoting module must be installed on the background server. The modules provided by mm are J2EE and. net two versions are charged, but there are two open-source (openamf, amfphp) on the Internet;
3. it seems that remoting does not provide good support for virtual hosts (you can search Google to see if there is any solution ). // ================================================ ===================;
// Code On The Flash end: (I use as1.0 as an example. Find other versions on the MM site)
// ========================================== ===========================;
// load the remoting component code. This is required.
# include "netservices. as "
// load the code of the remoting debugging module. This is optional. Use netconnection debugger to view debugging information.
# include" netdebug. as "
If (inited = NULL) {
inited = true;
// sets the default gateway.
netservices. setdefagategatewayurl ("http: // localhost: 8500/flashservices/Gateway");
// establishes a gateway connection.
gateway_conn = netservices. creategatewayconnection ();
// get a service;
myservice = gateway_conn.getservice ("myservice", this);
}
// define the function to call the method.
function getstring (name) {
// call the getstring method of remoting.
myservice. getstring (name);
}< br> // defines the function of the returned result.
function getstring_result (result) {
// The result is the returned result;
trace (result);
}< br> // defines the function of the returned state. This is optional.
function getstring_status (error) {
trace ("getstring_status");
trace (error. code);
trace (error. description);
trace (error. details);
}
// Call a function;
Getstring ("kinglong "); // ================================================ ===================;
// Server method definition (Here we use ColdFusion component as an example. For other versions, refer to relevant materials)
// ================================================ ===================;
<! --- File name: myservice. CFC --->
<Cfcomponent displayname = "my services">
<! --- The getstring method is defined. You must set access to remote. Otherwise, flash remoting cannot call this method. --->
<Cffunction name = "getstring" Access = "remote" returntype = "string">
<Cfargument name = "name" type = "string" required = "true">
<Cfset myresult = arguments. Name & ", welcome! ">
<Cfreturn myresult>
</Cffunction>
</Cfcomponent>
Attached to the Flash remoting online help file (flash remoting livedocs), The remoting information on the MM website.
Source: Blue ideal