![MACROMEDIA FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT... Use Manual Download Page 95](http://html1.mh-extra.com/html/macromedia/flash-remoting-mx-using-flash-remoting-for-flash-mx-2004-actionscript/flash-remoting-mx-using-flash-remoting-for-flash-mx-2004-actionscript_use-manual_3385355095.webp)
Using the NetConnection Debugger in ActionScript
95
Using the Netdebug.initialize() method
The
NetDebug.initialize()
method initializes debug support for Flash Remoting. You must
call this method prior to creating a connection or using any debugging operations, and typically
before any ActionScript is executed in the SWF file. This method returns the Boolean value
true
if it initializes debug support successfully. Otherwise, it returns a value of
false
. The following
statements, for example, initialize debug support for Flash Remoting before creating a connection
to a remote service. The example connects to the CustomerData service used by the
CustomerInfoExampleAPI sample application:
import mx.remoting.Service;
import mx.services.Log;
import mx.remoting.debug.NetDebug;
function CustomerDisplayForm() {
NetDebug.initialize();
super();
var custService:Service = new Service(
"http://examples.macromedia.com/flashservices/gateway/",
new Log(Log.DEBUG,"CustomerDisplayApp"),
"petmarket.api.catalogservice",
null,
null);
}
CustomerDisplayForm();
For more information on the
NetDebug.initialize()
method, see the NetDebug class in the
Flash Remoting ActionScript Dictionary in Help. For information about the
CustomerInfoExampleAPI sample application, see
“Using the Flash Remoting ActionScript API
in the CustomerInfoExampleAPI application” on page 47
.
Using the NetDebug.trace() method
The
NetDebug.trace()
method displays a trace message in the NetConnection Debugger. For
example, the following
NetDebug.trace()
method displays a trace message with the text “I just
created myService.” in the NetConnection Debugger:
NetDebug.trace("I just created myService.");
The argument to the
NetDebug
.
trace()
method is not limited to a string. It can be a Flash
object. For example, you can use the
NetDebug.trace()
method to report the values of multiple
variables, as in the following code:
NetDebug.trace({arg1value:arg1, arg2value:arg2});
Using connection-specific debugging methods
If your application uses multiple connections, you can use the debugging-related methods of each
Connection object to debug the individual connections.
The
setDebugId()
method creates an ID that is displayed in the NetConnection Debugger
output for events associated with the specific Connection object; for example:
gatewayConnection.setDebugId("Gateway Connection");