Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Remoting / March 2006



Tip: Looking for answers? Try searching our database.

Flash Remoting error handling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex_bs - 20 Mar 2006 14:38 GMT
:o
HI there,

Does anybody know how to handle a connection error in Flash Remoting (NOT
service error but gateway ) ?

I could not find example codes or help documentation, so I apreciate
any help.

Take a look at the code below(Flash 8 / AS.2.0):


//==============================================================================
================

import mx.services.Log;
import mx.remoting.Service;
import mx.remoting.DataGlue;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;

class Connect_ap{
       
        function  Connect_ap(){
                // let?s say the link is wrong:
                var link_server= "http://localhost/sites/amf/gatewwway.php";
                var service="Begin";
                var cone = new Service(link_server,null,service);
               
        }
       
}

// After testing I noticed that If the link is wrong , the service
fault-handling function returns nothing in this case;

//==============================================================================
================

function list(){
       
        var pcs:PendingCall = cone.list();
        pcs.responder = new RelayResponder(this,"list_Result","list_Fault");
}

// * HERE *:fault-handling works only for services, not for connection errors:

function list_Fault(fault:FaultEvent){
        trace("Service error:...")
        trace(fault.fault.faultstring);
}


//==============================================================================
================

So, How do I handle this kind of error in an aplication ?

Thanks for any help !
Trensic - 20 Mar 2006 21:38 GMT
I get an error on both if I change the gateway or the method so hopefully this
helps...

import mx.remoting.Service;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.remoting.DataGlue;
import mx.controls.Alert;

mx.remoting.debug.NetDebug.initialize();

//
--------------------------------------------------------------------------------
// START ALERT WINDOW
//
--------------------------------------------------------------------------------
// Define alert window
function AlertWindow() {
    Alert.show(alert_ErrorMessage, alert_ErrorType, Alert.OK, this, null,
"stockIcon", null);
    delete alert_ErrorMessage;
    delete alert_ErrorType;
}
//
--------------------------------------------------------------------------------
// END ALERT WINDOW
//
--------------------------------------------------------------------------------
//
//
--------------------------------------------------------------------------------
// START COMPONENT FUNCTIONS
//
--------------------------------------------------------------------------------
// ***** START GroupsTypes Connection
// Defined connection to component
function getGroupType() {
    var GroupsTypes_sr:Service = new Service("http://yogi/flashservices/gateway",
new Log(Log.Debug), "Revity40.Logic.Documents.DM_getGroupType", null, null);
    var GroupsTypes_pc:PendingCall = GroupsTypes_sr.getGroupType();
    GroupsTypes_pc.responder = new RelayResponder(this, "getGroupType_Result",
"getGroupType_Fault");
}
// handle a successfull conn
function getGroupType_Result(re:ResultEvent) {
    //trace(re.result);
    GroupType_tree.dataProvider = re.result;
    GroupType_tree.vScrollPolicy = "on";
    GroupType_tree.hScrollPolicy = "on";
    GroupType_tree.maxHPosition = 400;
    GroupType_tree.addEventListener("change", getGroupType_Change);
}
// handle a non-successfull conn
function getGroupType_Fault(fault:FaultEvent):Void {
    //trace("fault error");
    alert_ErrorMessage = "We could not connect to the data connector (Method:
DM_getGroupType)"+" System Message: "+fault.fault.faultstring;
    alert_ErrorType = "System Error";
    AlertWindow();
}
// run the function
getGroupType();
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.