Developer Component: NetConnection Debugger

Before you can use the NetConnection Debugger, you must add a single line of ActionScript to your application (see Figure 5.12). This single line of code adds the required class files to your Flash application to enable the NetConnection Debugger.

Figure 5.12. Adding the NetDebug class files to your Flash application using ActionScript.

graphics/05fig12.gif

To add the class files, follow these steps in the Flash MX authoring environment:

  1. Open your Communication application (myFirstApp.fla) in the Flash MX authoring environment.

  2. Open the Actions panel by selecting Window, Actions (or press F9).

  3. Turn the Actions panel into Expert mode by pressing Ctrl+Shift+E. This allows you to manually add the line of script to your application.

  4. Click the First Frame in the first layer of your movie (or a specified Actions layer that you may have set up) and enter the following line of code in the Actions panel:

    #include "NetDebug.as"; 
    
  5. Open the NetConnection Debugger in Flash MX by selecting Window, NetConnectionDebugger.

  6. Test your communications movie in Flash MX by selecting Control, Test Movie or pressing Ctrl+Enter.

When the movie runs, the NetConnection Debugger begins to display numerous events on the left side of the panel. This is the Flash player communicating with the server.

The NetDebug.as file was installed in the \Macromedia\Flash MX\Configuration\Include\folder. Any files placed in this folder can be included into Flash MX without specifying a directory path. When engaged, the NetConnection Debugger monitors any AMF activity on your computer. This is helpful if you need to watch exchanges between two Flash players open outside Flash MX (including applications running within a web browser).

Take a moment and scroll through the list of events. The debugger is not interactive, meaning that you cannot affect your movie with anything you do in this panel. To view expanded details, click the Details tab on the right side. Figure 5.13 displays detail of the first Communication Server event, Connect, originating from the Flash player.

Figure 5.13. The NetConnection Debugger in action. Filters and preference can be displayed by clicking the Filters and Preferences arrows.

graphics/05fig13.gif

Warning

Tracking problems you might have in your code, or trying to sort out unusual server behaviors, will be easier with this tool. The NetDebug class files are not required and should be commented out when you are ready to deploy your application to a production server. The file will add unnecessary file size to your SWF movie.




    Part I: 10 Quick Steps for Getting Started
     
    ASPTreeView.com
     
    Evaluation has ЩєЅХЩРµАјexpired.
    Info...