mx.remoting.debug
Class NetDebug



class NetDebug
extends Object

The NetDebug class lets you trace function calls, parameters, and results among the Flash application, Flash Remoting, and the application server. You use the NetConnection Debugger (NCD) panel in the Flash authoring environment to view the debugging results. To use the NetConnection Debugger and the NetDebug class, you must first do the following:

  1. Drag the RemotingDebugClasses library to the stage. For information on adding and removing the RemotingDebugClasses library to your application, see The NetConnection Debugger.
  2. Import the NetDebug class in the first frame of the Flash application by placing the following import statement at the beginning of your application:
           import mx.remoting.debug.NetDebug;
           
  3. Call the NetDebug.initialize() method before connecting to the service or calling any other debugging methods.
For information on how to use the NetConnection Debugger, see The NetConnection Debugger.

Example
The following example calls the NetDebug.initialize() method to initialize debug support, then connects to the CustomerInfo service and, if the debug flag has a value of true, it calls the NetDebug.trace() method to display a message in the NetConnection Debugger.
   import mx.remoting.Service; 
   import mx.rpc.RelayResponder; 
   import mx.remoting.PendingCall; 
   import mx.remoting.debug.NetDebug;
   import mx.services.Log;
   
   var debug:Boolean = NetDebug.initialize();
   var custService = new Service("http://custinfo/flashservices/gateway", new Log(), "CustomerInfo", null, null);
   custService.getService("myService", this);
   if(debug)
   {
     NetDebug.trace({level:"testing", message:"This is the message field of an object sent the NCD via trace"});
   } 
   



Methods
staticinitialize( )  : Boolean
Initializes the Flash Remoting debug support.
statictrace( obj: Object)  : Void
Sends a serializable ActionScript object as a client trace event to the NetConnection Debugger.


Properties
staticversion: String
Component version.


Method Detail

initialize

static  initialize( )  : Boolean

Initializes the Flash Remoting debug support. You must call this method prior to establishing a connection or using any of the debugging operations. Typically, you call this method as one of the first initialization steps in your Flash Remoting application. Before initializing debug support, you must first add the RemotingDebugClasses library to your application. For information this and on how to invoke and use the NetConnection Debugger, see The NetConnection Debugger.

Returns
    A Boolean value that returns a value of true if debug support is successfully initialized; otherwise, it returns false.

Example
The following example initializes debug support before connecting to a remote service. It first imports the NetDebug class and then calls the NetDebug.initialize() method to initialize debug support before creating a gateway connection to the customerData service.
   // import NetDebug class
   import mx.remoting.debug.NetDebug;
   import mx.remoting.Service;
   import mx.rpc.RelayResponder;
   import mx.remoting.PendingCall;
   // initialize debugging support
   var debug:Boolean = NetDebug.initialize();
   custService = new Service( 
     "http://localhost:8300/flashservices/gateway",
     null, 
"customerData", // access customerData service null, null); // call service method var pc:PendingCall = custService.getCategories(); // get all categories // establish result and fault handler methods pc.responder = new RelayResponder(this, "onCategoryData", "onCategoryFault" );
You can effectively combine the steps of importing the NetDebug file and calling the NetDebug.initialize() method by specifying the full class name when you invoke the method. The constructor for the CustomerInfoForm class in the CustomerInfoExampleAPI sample application uses this technique, shown in the fourth line of the following example:
   class CustomerInfoForm extends Form {
   function CustomerInfoForm() {
     super(); // perform superclass initialization
     mx.remoting.debug.NetDebug.initialize(); // initialize the NCD
     custService = new Service(
       "http://localhost:8300/flashservices/gateway",
       null,
       "customerData",
       null,
       null);
     // load category combo
     var pc:PendingCall = custService.getCategories(); // get all categories
     pc.responder = new RelayResponder(this, "onCategoryData", 
       "onCategoryFault" );
   }
   
For the complete CustomerInfoExampleAPI sample application, see Using the Flash Remoting ActionScript API in the CustomerInfoExampleAPI application.

See Also
    mx.remoting.Connection.getDebugConfig
    mx.remoting.Connection.getDebugId
    mx.remoting.Connection.setDebugId
    mx.remoting.Connection.trace
    mx.remoting.debug.NetDebug.trace


trace

static  trace( obj: Object)  : Void

Sends a serializable ActionScript object as a client trace event to the NetConnection Debugger. This trace event does not include connection information. For information on how to invoke and use the NetConnection Debugger, see The NetConnection Debugger.

Parameters
    obj: Object - the ActionScript object that is sent to the debugger.

Example
The following example calls the NetDebug.initialize() method to initialize debug support, then connects to the CustomerInfo service and, if the debug flag has a value of true, it calls the NetDebug.trace() method to display a message in the NetConnection Debugger.
   import mx.remoting.Service; 
   import mx.rpc.RelayResponder; 
   import mx.remoting.PendingCall; 
   import mx.remoting.debug.NetDebug;
   import mx.services.Log;
   
   var debug:Boolean = NetDebug.initialize();
   var custService = new Service("http://custinfo/flashservices/gateway", new Log(), "CustomerInfo", null, null);
   custService.getService("myService", this);
   if(debug)
   {
     NetDebug.trace({level:"testing", message:"This is the message field of an object sent the NCD via trace"});
   } 
   

See Also
    mx.remoting.Connection.getDebugConfig
    mx.remoting.Connection.getDebugId
    mx.remoting.Connection.setDebugId
    mx.remoting.Connection.trace
    mx.remoting.debug.NetDebug.initialize


Property Detail

version

static  version: String  

Component version. For internal use only.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flashremoting/mx2004/actionscript_api_reference/mx/remoting/debug/NetDebug.html