fabioterracini
01-27-2003, 01:14 PM
Hello all,
I develop Flash Remoting + CFMX applications and I'm trying code a way so the application can be accessed in the intranet and the extranet, with the same code. This is, if can't establish a connection with the local server, connect with the remote server. The code i'm working on is below. Copy-and-paste in Flash for color-coding. :)
What happens is the following: If it connected to local server (intranet), it call's getMailings_Result() [automatically], and the application continues. If it can't establish a connection to the local server, it try to connect to the remote server, and it *really* connects (I see in output window that it received informations from the server), but it don't call the getMailings_Result() function, and the application don't continues as expected.
I hope I explained well and say thanks anticipatedly!
#include "NetServices.as"
if (inited == undefined) {
inited = true;
webservice_server = "TIKUNA";
NetServices.setDefaultGatewayUrl("http://tikuna/flashservices/gateway");
cfc_location = "contatos.qry.cfc_contatos";
gatewayConnection = NetServices.createGatewayConnection();
getMailingsServerCall = gatewayConnection.getService(cfc_location, this);
getMailingsServerCall.getMailings();
}
gatewayConnection.onStatus = function(status) {
// can't connect
// *try* to connect to remote server
trace("Can't connect to "+webservice_server);
webservice_server = "XINGU";
NetServices.setDefaultGatewayUrl("http://www.server.com.br/flashservices/gateway");
cfc_location = "intranet.contatos.qry.cfc_contatos";
gatewayConnection = NetServices.createGatewayConnection();
getMailingsServerCall = gatewayConnection.getService(cfc_location, this);
getMailingsServerCall.getMailings();
}
function getMailings_Result(result) {
// everything ok, connected at webservice
trace("Connected to "+webservice_server);
}
I develop Flash Remoting + CFMX applications and I'm trying code a way so the application can be accessed in the intranet and the extranet, with the same code. This is, if can't establish a connection with the local server, connect with the remote server. The code i'm working on is below. Copy-and-paste in Flash for color-coding. :)
What happens is the following: If it connected to local server (intranet), it call's getMailings_Result() [automatically], and the application continues. If it can't establish a connection to the local server, it try to connect to the remote server, and it *really* connects (I see in output window that it received informations from the server), but it don't call the getMailings_Result() function, and the application don't continues as expected.
I hope I explained well and say thanks anticipatedly!
#include "NetServices.as"
if (inited == undefined) {
inited = true;
webservice_server = "TIKUNA";
NetServices.setDefaultGatewayUrl("http://tikuna/flashservices/gateway");
cfc_location = "contatos.qry.cfc_contatos";
gatewayConnection = NetServices.createGatewayConnection();
getMailingsServerCall = gatewayConnection.getService(cfc_location, this);
getMailingsServerCall.getMailings();
}
gatewayConnection.onStatus = function(status) {
// can't connect
// *try* to connect to remote server
trace("Can't connect to "+webservice_server);
webservice_server = "XINGU";
NetServices.setDefaultGatewayUrl("http://www.server.com.br/flashservices/gateway");
cfc_location = "intranet.contatos.qry.cfc_contatos";
gatewayConnection = NetServices.createGatewayConnection();
getMailingsServerCall = gatewayConnection.getService(cfc_location, this);
getMailingsServerCall.getMailings();
}
function getMailings_Result(result) {
// everything ok, connected at webservice
trace("Connected to "+webservice_server);
}