Hello guys,
I have a question ( i search from 2 day with google to find a way), i have a class for remoting service for flash using amfphp! I have done every as wanted, but the want that i use 3 gateways, and to connect to the first one that works (is online), i have something like this my code:
private var gatewayUrl_0:String = "http://server1/flashservices/gateway.php";
private var gatewayUrl_1:String = "http://server2/flashservices/gateway.php";
private var gatewayUrl_2:String = "http://server3/flashservices/gateway.php";
private var tried:Number = 0;
function getDatabase()
{
NetDebug.initialize();
this.service = new Service(this.gatewayUrl_0, null, "getDatabase");
this.doRead();
this.tried++;
}
function doRead()
{
var pc:PendingCall = service.doRead();
pc.responder = new RelayResponder(this, "handleDoRead", "handleRemotingError");
this.xml.load("http://server/flashservices/services/cameraLink.xml");
}
function handleDoRead(re:ResultEvent)
{
this.dataGrid.dataProvide = RecordSet(re.result);
}
function handleRemotingError(er:FaultEvent)
{
if(this.tried==1)
{
this.service = new Service(this.gatewayUrl_1, null, "getDatabase");
this.doRead();
}
else if(this.tried==2)
{
this.service = new Service(this.gatewayUrl_2, null, "getDatabase");
this.doRead();
}
else if(this.tried==3)
{
trace("NO GATEWAY WORKING");
}
But this doesn’t work, can somebody help me?
Thank you in advance, btibia! :thumb2: