NetDebug.trace( )

NetDebug.trace( ) MethodFlash 6

displays a value in the NetConnection debugger



Any string or ActionScript object that is serializable as a string.


The trace( ) method is used during debugging to display a string, object, or other value in the NetConnection Debugger panel. This is useful during debugging for determining where a particular problem might be occurring.

The file must be included in order to use the trace( ) method, and the NetConnection Debugger panel must be open as well.


The following code shows the basic syntax of the trace( ) method:

#include ""
#include ""

if (connected == null) {
  connected = true;
  var my_conn = NetServices.createGatewayConnection( );
  NetDebug.trace("URL established");
  var my_service = my_conn.getService("com.oreilly.frdg.searchProducts");
  NetDebug.trace("Service object created");

The trace( ) statements in this block of code merely alert the developer that a specific line in the code was reached. This is helpful for narrowing down problems in blocks of code. The output of the NetDebug.trace( ) method is sent to the NetConnection debugger (don't confuse it with the global trace( ) function, which displays text in the Flash authoring tool's Output window).

See Also

NetConnection.trace( ), the NetDebugConfig class; Chapter 13

    Part III: Advanced Flash Remoting